// shared config (dev and prod) const { resolve } = require('path') const { CheckerPlugin, TsConfigPathsPlugin } = require('awesome-typescript-loader') const StyleLintPlugin = require('stylelint-webpack-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin') module.exports = { resolve: { extensions: ['.ts', '.tsx', '.js', '.jsx', '.scss'], plugins: [ new TsConfigPathsPlugin() ], alias: { '@styles': resolve(__dirname, 'src/styles/') }, }, context: resolve(__dirname, '../../src'), module: { rules: [ { test: /\.js$/, use: ['babel-loader', 'source-map-loader'], exclude: /node_modules/, }, { test: /\.tsx?$/, use: ['babel-loader', 'awesome-typescript-loader'], }, { test: /\.css$/, use: ['style-loader', { loader: 'css-loader', options: { importLoaders: 1 } }], }, { test: /\.scss$/, loaders: [ 'style-loader', { loader: 'css-loader', options: { importLoaders: 1 } }, 'sass-loader', ], }, { test: /\.(jpe?g|png|gif|svg)$/i, loaders: [ 'file-loader?hash=sha512&digest=hex&name=img/[hash].[ext]', 'image-webpack-loader?bypassOnDebug&optipng.optimizationLevel=7&gifsicle.interlaced=false', ], }, ], }, plugins: [ new CheckerPlugin(), new StyleLintPlugin(), new HtmlWebpackPlugin({ template: 'index.html.ejs', }), ], externals: { 'react': 'React', 'react-dom': 'ReactDOM', }, performance: { hints: false, }, }