Closed kogai closed 5 years ago
Thanks for the example! Just as you said, it is because html-webpack-externals-plugin
is removing the files from webpack's asset list.
You can either set cleanStaleWebpackAssets: false
or:
new CleanWebpackPlugin({
cleanAfterEveryBuildPatterns: ['!vendor/**/*'],
}),
OK, I got it. Thanks 👍
Issue description or question
If webpack is running by watch mode,
clean-webpack-plugin
seems to remove modules whichhtml-webpack-externals-plugin
provided (of course it doesn't applied any changes) as stale one.I'd created a minimum reproduction environment here.
And I guess it causes from
Stats
which webpack provides to plugin doesn't includes fileshtml-webpack-externals-plugin
provides.https://github.com/johnagan/clean-webpack-plugin/blob/master/src/clean-webpack-plugin.ts#L186-L194
https://github.com/johnagan/clean-webpack-plugin/blob/master/src/clean-webpack-plugin.ts#L232-L245
In my situation, setting
cleanStaleWebpackAssets
as true toclean-webpack-plugin
could resolves such problem actually.However, it seems unintentional behavior of the plugin.
Webpack Config
Environment
Run:
npx envinfo --system --binaries --npmPackages clean-webpack-plugin,webpack