New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: minimize css when css experiment is enabled #17309
base: main
Are you sure you want to change the base?
Conversation
For maintainers only:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should postpone it for webpack v6, cssnano is big and slow and we need to think about it deeply, perhaps we can collaborate with the rspack team
If speed is the concern then we could try out LightningCSS. Though a different problem with |
@hardfist We should collaborate here, maybe not this exact implementation but have a common goal for CSS minification for native CSS support? |
we are using swc-css to minify css because we are also using swc-css to support native css,but swc-css might have bigger size than lightning css,which may be a concern for webpack |
@hardfist Node.js 10 is not our radar, so we can say - if you want the latest feature - do not use node.js 10, you the latest LTS, but yeah wasm solution will be fine (still need check perf) |
since webpack already implemented a css parser for native css support, it seems webpack could reimplement the css minification using the same parser(same parser for parse & minification seems ideal, but it maybe out of scope) |
I agree with that, webpack's default css minifier should be small & fast otherwise people may blame webpack for speed, and it seems vite5 may plan to choose lightning css as css minifier vitejs/vite#12466. |
@hardfist yeah, but there is a performance bottleneck between js and rust - serialization (you know 😄 ), I honestly don't know what would be better for us:
|
Perhaps we should really look at wasm and focus our efforts on swc minificator |
serialization maybe not a problem for minify but a problem for parse,if size is not a concern for webpack i think swc minification or lightingcss is a better option for css minify |
Yeah, I will think about it more |
vite has added support for lightningcss vitejs/vite#12807 |
@burhanuday We've been supporting this for a long time (minimizers), even more - we support all known CSS minimizer |
Part of #14893
Maybe we could start with using the existing webpack plugin rather than building another one from scratch?
Summary
🤖 Generated by Copilot at d3ad1ac
This pull request adds support for CSS minification as an experimental feature in webpack 5. It introduces a new dev dependency,
css-minimizer-webpack-plugin
, and modifies the default configuration, the test framework, and the test cases to enable and verify the feature.Details
🤖 Generated by Copilot at d3ad1ac
describeCases
function intest/ConfigTestCases.template.js
to appendcss-minimizer-webpack-plugin
to theminimizer
array ifcss
experiment is enabled (link)test/configCases/optimization/css-minimize
(link, link, link, link)