Closed viceice closed 5 years ago
This is expected if webpack's output.path
is nested or shared. You will want to clean webpack's output.path
before running webpack (See #60 for an example).
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: [], // disable initial clean
});
Probably a safer (more correct?) approach is to let each webpack config use a different destination sub-folder? And then add a CleanWebpackPlugin
to each config, targeting the specific destination sub-folder?
(If all you want is to wipe the destination folder on startup, you can do that by just adding a rm -rf
command to your build/watch scripts.)
@mindplay-dk For my setup they have to be in the same folder, because they will be required from there
I had a similar issue. I create another Webpack config with entry point as a empty file and output folder as the folder which i want to clean. And I ran those webpack in sequence. That cleaned my output folder and I didn't face any issue with multiple configs.
` const path = require('path'); const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = { mode: 'production', entry: { clean: './clean.js', }, output: { path: path.resolve('./build/client'), }, plugins: [ new CleanWebpackPlugin(), ], } `
Issue description or question
Using multiple webpack configs is not possible, because the latest build will delete the files from other build.
Webpack Config
Environment