Repository navigation
Commit 951d0c6
authored
Support CSS asset names with fragment/query suffixes in minifier (#22277)
* fix(css): minify assets with fragment suffixes
* fix: minify JS, CSS and HTML assets whose names carry a fragment
webpack itself emits such names: asset modules default to
`[hash][ext][query][fragment]`, and `output.filename` may contain `#`.
Widen the `jsMinify`/`htmlMinify` filters and the default minimizer's
`test` (both branches) to accept a `#` suffix, and cover it with a
config case that emits these names through webpack rather than by
writing to `compilation.assets`.
Claude-Session: https://claude.ai/code/session_01EpeANYvMKyZwSDTRVE5LoG
* fix: read a minified asset's extension before its query or fragment
`/\.css(?:[?#].*)?$/` also claimed `data.txt#a.css`, and the CSS minifier
then emptied it. Anchor the three filters and the default `test` so the
extension is the one before the first `?` or `#`.
Claude-Session: https://claude.ai/code/session_01EpeANYvMKyZwSDTRVE5LoG
* test: snapshot the minified fragment-named assets
Claude-Session: https://claude.ai/code/session_01EpeANYvMKyZwSDTRVE5LoG
* test: compare the unminified asset to its source, not an LF literal
Claude-Session: https://claude.ai/code/session_01EpeANYvMKyZwSDTRVE5LoG1 parent a924765 commit 951d0c6
14 files changed
Lines changed: 148 additions & 4 deletions
File tree
- .changeset
- lib
- config
- css
- html
- javascript
- test/configCases/asset-modules/minimize-fragment-names
- __snapshots__
- files
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2558 | 2558 | | |
2559 | 2559 | | |
2560 | 2560 | | |
| 2561 | + | |
| 2562 | + | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
2561 | 2569 | | |
2562 | 2570 | | |
| 2571 | + | |
2563 | 2572 | | |
2564 | 2573 | | |
2565 | 2574 | | |
| |||
2622 | 2631 | | |
2623 | 2632 | | |
2624 | 2633 | | |
2625 | | - | |
| 2634 | + | |
2626 | 2635 | | |
2627 | 2636 | | |
2628 | 2637 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
| 255 | + | |
256 | 256 | | |
257 | 257 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
| 270 | + | |
271 | 271 | | |
272 | 272 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments