Plugin has unexpected effects if not added first
hubgit opened this issue · comments
Issue description
workbox-webpack-plugin
has an option to add a versioned workbox
folder to the output directory.
When clean-webpack-plugin
v3 is in the plugins list before workbox-webpack-plugin
everything works as expected, but when it's in the plugins list after workbox-webpack-plugin
the versioned workbox
folder is missing.
With clean-webpack-plugin
v2 the workbox
folder is always present.
Webpack Config
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const WorkboxWebpackPlugin = require("workbox-webpack-plugin");
module.exports = {
mode: "production",
plugins: [
new CleanWebpackPlugin(), // workbox directory is present
new WorkboxWebpackPlugin.GenerateSW({
importWorkboxFrom: "local"
})
// new CleanWebpackPlugin() // workbox directory is missing
]
};
Environment
clean-webpack-plugin: ^3.0.0 => 3.0.0
webpack: ^4.35.0 => 4.35.0
workbox-webpack-plugin: ^4.3.1 => 4.3.1
Repository to reproduce the issue: https://github.com/hubgit/clean-workbox-example
Thanks for the repo! I think the right thing to do here is document this behavior in the readme.
Basically if you are using a webpack that modifies files directly instead of letting webpack do the work this will be an issue.