Skip to content

Commit 7fcca1c

Browse files
committed
bug #772 Setting CleanWebpackPlugin's cleanStaleWebpackAssets: false (weaverryan)
This PR was merged into the master branch. Discussion ---------- Setting CleanWebpackPlugin's cleanStaleWebpackAssets: false There is currently a bug where, on a "watch" rebuild, sometimes an image that's referenced from a CSS file won't be "noticed" and will be mistakenly deleted. Reproducer: https://github.com/weaverryan/clean_webpack_assets_watch_bug I haven't had time yet to "distill" that reproducer down to a raw `webpack.config.js` file (without Encore) so that I can submit an issue. But, since this behavior can be quite damaging (I was pulling out my hair trying to figure out why an image file was there sometimes and gone other times) and because the `cleanStaleWebpackAssets` is so *minor* (it removes extra files on `watch` rebuilds), I think we should just disable it by default. Commits ------- 39e4619 Setting CleanWebpackPlugin's cleanStaleWebpackAssets: false
2 parents b989e37 + 39e4619 commit 7fcca1c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/plugins/clean.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ module.exports = function(plugins, webpackConfig) {
2929

3030
const cleanWebpackPluginOptions = {
3131
verbose: false,
32-
cleanOnceBeforeBuildPatterns: webpackConfig.cleanWebpackPluginPaths
32+
cleanOnceBeforeBuildPatterns: webpackConfig.cleanWebpackPluginPaths,
33+
// disabled to avoid a bug where some files were incorrectly deleted on watch rebuild
34+
cleanStaleWebpackAssets: false
3335
};
3436

3537
plugins.push({

0 commit comments

Comments
 (0)