diff options
author | Vitaly Takmazov | 2023-09-11 09:29:12 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-09-11 09:38:20 +0300 |
commit | a907348d931510fea77546e8748a1fcf2c73ea0a (patch) | |
tree | 7ac4f6991dcb66e2e4298d8951e78fb3b056a553 /webpack.config.js | |
parent | 1872c44992091df97dfd1a53053044a2264f5dc6 (diff) |
Minimize CSS in production builds
Diffstat (limited to 'webpack.config.js')
-rw-r--r-- | webpack.config.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/webpack.config.js b/webpack.config.js index d362c06f..450adeeb 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,12 +1,11 @@ const ESLintPlugin = require('eslint-webpack-plugin') const MiniCssExtractPlugin = require('mini-css-extract-plugin') +const CssMinimizerPlugin = require('css-minimizer-webpack-plugin') const TerserPlugin = require('terser-webpack-plugin') -module.exports = () => { - const node_env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development' - const dev = node_env !== 'production' +module.exports = (env, argv) => { + const dev = argv.mode !== 'production' const config = { - mode: node_env, devtool: dev ? 'source-map' : false, entry: { 'scripts': [ @@ -99,6 +98,7 @@ module.exports = () => { // Link to options - https://swc.rs/docs/config-js-minify terserOptions: {}, }), + new CssMinimizerPlugin() ] } return config |