const path = require('path') const CssMinimizerPlugin = require('css-minimizer-webpack-plugin') const TerserPlugin = require('terser-webpack-plugin') module.exports = { mode: 'production', performance: { assetFilter: (assetFilename) => !/\.map$/.test(assetFilename), hints: 'error', maxAssetSize: 300 * 1024, // 300KB }, cache: false, output: { path: path.resolve(__dirname, 'prod_build'), pathinfo: false, }, optimization: { minimizer: [ new CssMinimizerPlugin(), new TerserPlugin(), ], flagIncludedChunks: true, usedExports: true, sideEffects: true, concatenateModules: true, emitOnErrors: false, nodeEnv: 'production', minimize: true, }, stats: 'errors-warnings', module: { unsafeCache: false, rules: [ { test: /\.css$/i, use: [ 'style-loader', 'css-loader' ], }, { test: /\.less$/i, use: [ 'style-loader', 'css-loader', { loader: 'less-loader', options: { lessOptions: { javascriptEnabled: true, }, }, }, ], } ] }, }