diff options
author | Vitaly Takmazov | 2020-10-12 03:49:35 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:55 +0300 |
commit | ba41af1e9eaedb699f6c3c496fc7fe9af8a9b21d (patch) | |
tree | 3dfc89733a20efedc6dd234c14f887feeedabb57 /vnext/webpack.config.js | |
parent | 24e2689ea82488a2505667556135afa0c5aed04c (diff) |
Modernize webpack config
Diffstat (limited to 'vnext/webpack.config.js')
-rw-r--r-- | vnext/webpack.config.js | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/vnext/webpack.config.js b/vnext/webpack.config.js index 3493184c..336f2d09 100644 --- a/vnext/webpack.config.js +++ b/vnext/webpack.config.js @@ -3,9 +3,10 @@ const path = require('path'); const HtmlWebPackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const TerserPlugin = require('terser-webpack-plugin'); -const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); +const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); const ErrorOverlayPlugin = require('error-overlay-webpack-plugin'); const ESLintPlugin = require('eslint-webpack-plugin'); +const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin'); module.exports = (env, argv) => { const dev = argv.mode !== 'production'; @@ -105,21 +106,14 @@ module.exports = (env, argv) => { if (dev) { config.plugins.push(new webpack.HotModuleReplacementPlugin()); + config.plugins.push(new ReactRefreshWebpackPlugin()); } else { config.optimization = { minimizer: [ - new TerserPlugin({ - cache: true, - parallel: true, - sourceMap: dev, - terserOptions: { - output: { - comments: /@license/i - } - }, - extractComments: true - }), - new OptimizeCSSAssetsPlugin({}) + '...', + new CssMinimizerPlugin({ + sourceMap: true + }) ], splitChunks: { chunks: 'all' |