Repository navigation
feat: safely minify native CSS and HTML via minimizer-webpack-plugin minify functions - #21491
Conversation
🦋 Changeset detectedLatest commit: 5790fff The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
5ee8cef to
75da844
Compare
75da844 to
4f6cab0
Compare
4f6cab0 to
9e79da8
Compare
9e79da8 to
b8eccce
Compare
b8eccce to
bc2a988
Compare
bc2a988 to
4e4f652
Compare
4e4f652 to
86890ca
Compare
86890ca to
f964fa2
Compare
f964fa2 to
046a8eb
Compare
|
This PR is packaged and the instant preview is available (7bc7d21). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@7bc7d21
yarn add -D webpack@https://pkg.pr.new/webpack@7bc7d21
pnpm add -D webpack@https://pkg.pr.new/webpack@7bc7d21 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #21491 +/- ##
==========================================
- Coverage 93.91% 93.77% -0.14%
==========================================
Files 620 621 +1
Lines 73729 74281 +552
Branches 21339 21544 +205
==========================================
+ Hits 69240 69655 +415
- Misses 4489 4626 +137
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Hooray! CodSpeed harness just leveled up!The base and head of this comparison were measured with different runner settings, so their benchmark values are not directly comparable. What changed between base and head:
Re-run the base with the same settings to get a valid performance comparison. Comparing Footnotes |
046a8eb to
7bda3fe
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7bda3fe. Configure here.
7bda3fe to
5790fff
Compare

Note
Medium Risk
Touches production default optimization and large new serialization logic where incorrect minification could change styles or DOM; mitigated by safety-focused printers and broad tests, but the surface area is substantial.
Overview
When
optimization.minimizeis on andexperiments.css/experiments.htmlare enabled, the defaultminimizer-webpack-pluginsetup now routes.cssand.htmlassets through newcssMinify/htmlMinifyhandlers alongside Terser in one worker pool (each minify function uses its ownfilter).CSS minification runs through
webpack.css.syntaxSourceProcessorwithminimize: true: a post-order printer collapses whitespace safely, keeps/*!/@license/@preservecomments, applies value-identical transforms (numbers, colors,rgb()), and returns{ code, map }for chaining with loader maps. HTML uses the same pattern viahtmlMinify: DOM-equivalent serialization, drops inert comments, keeps conditional/SSI comments; maps are not used yet.Shared
lib/util/SourceProcessorgainsPrintContext, optional node printers, andprocess(..., { minimize: true }).webpack.css.syntaxandwebpack.html.syntaxare exposed on the public API. Config-case and unit tests cover emitted output and CSS source-map composition.Reviewed by Cursor Bugbot for commit 5790fff. Bugbot is set up for automated code reviews on this repo. Configure here.