diff --git a/webpack.config.js b/webpack.config.js index d1d630dd3..42399e454 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -55,6 +55,11 @@ const baseConfig = { output: { filename: 'js/[name].js' }, + stats: { + warnings: true, // Show warnings + errors: true, // Show errors + errorDetails: true // Include stack traces and details + }, plugins: [ new MiniCssExtractPlugin({ filename: 'css/[name].css', @@ -103,7 +108,11 @@ const developmentConfig = { new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('development') }) - ] + ], + performance: { + hints: 'warning' // Show performance warnings in development + }, + ignoreWarnings: [] // No warnings are ignored in development } // special config for production @@ -113,10 +122,19 @@ const productionConfig = { 'process.env.NODE_ENV': JSON.stringify('production') }) ], - optimization: { + optimization: { minimize: true, - minimizer: [new TerserPlugin()] - } + minimizer: [new TerserPlugin()], + emitOnErrors: true // Fail build on errors + }, + performance: { + hints: false // Suppress performance warnings in production + }, + ignoreWarnings: [ // Suppress several warnings + { message: /performance recommendations/ }, + { message: /asset size limit/ }, + { message: /entrypoint size limit/ } + ] } // combine config depending on the provided --mode command line option