Answer the question
In order to leave comments, you need to log in
Why doesn't plugins work when splitting webpack.config into modules?
If you write everything in 1 config, it works without problems, but if you move the settings to common.js + production.js, then minimizing and cleaning the directory stops working. Why doesn’t it work, because I checked, and the output is a normal config?
const merge = require('webpack-merge');
const path = require('path');
const webpackCommon = require('./webpack.common');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const common = {
minimize: true,
devtool: 'source-map',
optimization: {
minimizer: [
new UglifyJsPlugin()
],
nodeEnv: 'production'
},
plugins: [
new CleanWebpackPlugin(['dist', 'build'], {
root: path.resolve(__dirname, '../'),
verbose: true,
dry: false
})
]
};
let options = merge([webpackCommon, common]);
module.exports = options;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question