const CleanWebpackPlugin = require('clean-webpack-plugin').CleanWebpackPlugin; const HtmlWebpackPlugin = require('html-webpack-plugin'); const ScssConfigWebpackPlugin = require('scss-config-webpack-plugin'); const TsConfigWebpackPlugin = require('ts-config-webpack-plugin'); const HtmlWebpackInlineSVGPlugin = require('html-webpack-inline-svg-plugin'); const TerserJSPlugin = require('terser-webpack-plugin'); module.exports = { devServer: { host: '0.0.0.0', disableHostCheck: true, watchOptions: { poll: true, }, }, plugins: [ // Cleans the dist folder before the build starts new CleanWebpackPlugin(), // Generate a base html file and injects all generated css and js files new HtmlWebpackPlugin({ template: './src/index.html', }), new HtmlWebpackInlineSVGPlugin({ inlineAll: true, svgoConfig: [ { removeViewBox: false, }, ], }), // SCSS Configuration for .css .module.css and .scss .module.scss files // see https://github.com/namics/webpack-config-plugins/tree/master/packages/scss-config-webpack-plugin/config new ScssConfigWebpackPlugin(), // Multi threading typescript loader configuration with caching for .ts and .tsx files // see https://github.com/namics/webpack-config-plugins/tree/master/packages/ts-config-webpack-plugin/config new TsConfigWebpackPlugin(), ], optimization: { minimizer: [ new TerserJSPlugin({ test: /\.js$/, exclude: /node_modules/, terserOptions: { keep_classnames: true, }, }), ], }, module: { rules: [ { test: /\.js$/, enforce: 'pre', use: ['source-map-loader'], }, ], }, };