johnagan / clean-webpack-plugin

A webpack plugin to remove your build folder(s) before building
MIT License
1.96k stars 136 forks source link

Deprecate plugin in favor `output.clean` #197

Open alexander-akait opened 3 years ago

alexander-akait commented 3 years ago

webpack has built-in support for clearing stale assets https://webpack.js.org/configuration/output/#outputclean, so I think we can deprecate this plugin

galvarez421 commented 3 years ago

I think output.clean does not clean the output directory when running webpack-dev-server, while this plugin seems to be able to.

alexander-akait commented 3 years ago

@galvarez421 it should, what is the problem?

vovkvlad commented 3 years ago

@alexander-akait it seems like output.clean does not clean files for webpack dev server, and you confirmed that it is not supposed to in the issue I logged recently

https://github.com/webpack/webpack/issues/12949

alexander-akait commented 3 years ago

I strongly recommend use the writeToDisk option only for files to be read from fs. otherwise you lose performance

yckbilly1929 commented 3 years ago

output.clean looks good but not sure if it supports cleanAfterEveryBuildPatterns?

alexander-akait commented 3 years ago

Why do you need cleanAfterEveryBuildPatterns? Can you describe use case?

yckbilly1929 commented 3 years ago

Why do you need cleanAfterEveryBuildPatterns? Can you describe use case?

I'm currently using it to remove intermediate files like sourcemap, after pushed to sentry maybe this is not the best practice, but suit the requirement

alexander-akait commented 2 years ago

/cc @johnagan what do you think? Maybe we need some more options for fully replace this plugin?