When I run the command npm run build
, it successfully minifies my js
and css
files. However, the code is still spread over multiple lines and includes comments. How can I instruct webpack
to compress it into a single line and remove comments?
This is what the build command looks like in my package.json
:
"build": "npm run buildsprite && webpack --config ./webpack/webpack.config.prod.js --colors"
Below is the optimization chunk from webpack.config.prod.js
:
optimization: {
minimizer: [
new TerserPlugin({
test: /\.js(\?.*)?$/i,
cache: true,
parallel: true,
sourceMap: true,
extractComments: false,
}),
],
},