Skip to content

[Feature]: Webpack's output.clean supports the useful option to optionally keep some files around #7822

@matthiask

Description

@matthiask

What problem does this feature solve?

Thank you for all the work y'all are doing on rspack! Not having to rethink all the frontend building configuration is really great.

Here's the documentation for the option:
https://webpack.js.org/configuration/output/#outputclean

I especially like using clean: { keep: /\.html$/ } to keep the generated HTML files around, so that different build or development processes do not delete each other's HTML files (generated by the html-webpack-plugin).

I could use different folders for each of them, but I thought it's worth submitting since it's a difference to webpack

What does the proposed API of configuration look like?

Webpack uses boolean | { dry?: boolean, keep?: RegExp | string | ((filename: string) => boolean) } according to the docs. A very useful, limited first step would be boolean | { keep?: RegExp }. I don't think the other options are needed except for feature parity. dry-running shouldn't matter -- if you want to clean up, clean up. If you do not, then don't. I also don't know why you'd want to use a callable here.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions