feat: support [uniqueName] and [uniquename] placeholders in template paths#21155
Conversation
…paths Resolves the TODO in CssIcssExportDependency by moving the [uniqueName] replacement into TemplatedPathPlugin's interpolate. The placeholder is now registered like every other one (with a lowercase [uniquename] alias) and defaults from output.uniqueName for all asset path templates. https://claude.ai/code/session_013dWoENYgy5kQ1FEcdpU92W
🦋 Changeset detectedLatest commit: 27e7944 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 |
|
This PR is packaged and the instant preview is available (c387c00). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@c387c00
yarn add -D webpack@https://pkg.pr.new/webpack@c387c00
pnpm add -D webpack@https://pkg.pr.new/webpack@c387c00 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21155 +/- ##
=======================================
Coverage 92.35% 92.35%
=======================================
Files 581 581
Lines 63332 63381 +49
Branches 17507 17527 +20
=======================================
+ Hits 58488 58537 +49
Misses 4844 4844
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:
|
Merging this PR will improve performance by 86.4%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Memory | benchmark "asset-modules-inline", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
1,296 KB | 318.7 KB | ×4.1 |
| ⚡ | Memory | benchmark "asset-modules-bytes", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
321.4 KB | 248 KB | +29.6% |
| ⚡ | Memory | benchmark "devtool-eval", scenario '{"name":"mode-production","mode":"production"}' |
7.7 MB | 6.3 MB | +22.89% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing feat/uniquename-placeholder (27e7944) with main (7bf5a72)
Summary
Resolves the
TODO move these things into interpolateinCssIcssExportDependencyfor[uniqueName]: the placeholder (plus a lowercase[uniquename]alias) is now a first-classinterpolateplaceholder, defaulting fromoutput.uniqueName, so it resolves in all asset path templates (output.filename,publicPath,chunkFilename,assetModuleFilename,localIdentName, …).What kind of change does this PR introduce?
feat
Did you add tests for your changes?
Yes —
test/TemplatedPathPlugin.unittest.js, newtest/configCases/output/unique-name-placeholder/, and extendedtest/configCases/css/local-ident-name/.Does this PR introduce a breaking change?
No.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
Document
[uniqueName]/[uniquename]as an available placeholder in template paths on the docs site.Use of AI
Implemented with Claude Code under my direction; I reviewed all changes and test results.
https://claude.ai/code/session_013dWoENYgy5kQ1FEcdpU92W
Generated by Claude Code