Repository navigation
Commit c256cbb
committed
fix: name chunk imports in the chunk loader
Baking a literal `import("./chunk.<hash>.js")` at every dynamic import site put the
imported chunk's content hash into the importing module, so a change to a lazily
loaded route invalidated every chunk on the path up to the initial wave — and the
chunk id to filename map in the runtime chunk stored the same hashes a second time.
The ESM chunk loader now holds the literal specifiers itself, keyed by chunk id, and
`.f.j` imports one instead of building a url from `.p + .u(id)`. Call sites go back
to `ensureChunk(id)`, so no importing module carries a chunk hash, the id to filename
map is not emitted where the loader names everything, and the output stays walkable:
every emitted chunk is still reached by a literal specifier a foreign bundler or a
preload scanner can follow. `__webpack_require__.ei` is gone with the call-site form.
Two bailout reasons moved with the decision: an output that cannot use a native
`import()` is reported where the imports are generated, and a runtime reading its
chunks another way reports from the chunk loader that will not serve it.
Closes #220561 parent 3ca6196 commit c256cbb
70 files changed
Lines changed: 663 additions & 631 deletions
File tree
- .changeset
- lib
- esm
- runtime
- test
- configCases
- analyzable
- block-origin-modules
- chunkhash-name-follows-fill
- circular-chunk-hashes-repaired
- circular-chunk-hashes
- circular-chunkhash-names
- concatenated-origin
- content-named-single-runtime
- contenthash-without-repair
- context-module
- css-chunk-import
- css-chunk-stays-analyzable
- css-content-hash-filename
- deferred-before-source-maps
- dynamic-import-contenthash
- dynamic-import-fetch-priority
- dynamic-import-public-path
- dynamic-import
- ensure-chunk-handlers
- function-chunk-filename
- glob-import
- hashed-chunk-filename
- html-chunk-stays-analyzable
- import-relative-public-path
- library-module-shipping
- library-module
- multi-chunk-import
- prefetch-child-import
- public-path-override-scope
- stand-in-lookalike
- templated-public-path
- two-depths-content-named
- html
- script-src-mixed/__snapshots__
- script-src/__snapshots__
- worker/worker-analyzable-import
- helpers
- hotCases
- esm-output/analyzable-import
- lazy-compilation/analyzable-import
- statsCases
- analyzable-esm-fallbacks
- __snapshots__
- output-module/__snapshots__
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| 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 | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
82 | | - | |
83 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
87 | | - | |
| 90 | + | |
| 91 | + | |
88 | 92 | | |
89 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
90 | 99 | | |
91 | 100 | | |
92 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
93 | 107 | | |
94 | 108 | | |
95 | 109 | | |
| |||
115 | 129 | | |
116 | 130 | | |
117 | 131 | | |
118 | | - | |
119 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
120 | 136 | | |
121 | 137 | | |
122 | 138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1215 | 1215 | | |
1216 | 1216 | | |
1217 | 1217 | | |
1218 | | - | |
| 1218 | + | |
1219 | 1219 | | |
1220 | 1220 | | |
1221 | 1221 | | |
1222 | 1222 | | |
1223 | | - | |
1224 | | - | |
1225 | | - | |
1226 | | - | |
1227 | | - | |
1228 | | - | |
1229 | | - | |
1230 | | - | |
1231 | | - | |
1232 | | - | |
1233 | | - | |
1234 | | - | |
1235 | | - | |
1236 | | - | |
1237 | | - | |
1238 | | - | |
1239 | | - | |
1240 | | - | |
1241 | | - | |
1242 | | - | |
1243 | | - | |
1244 | | - | |
1245 | | - | |
1246 | | - | |
1247 | | - | |
1248 | | - | |
1249 | | - | |
1250 | | - | |
1251 | | - | |
1252 | | - | |
1253 | | - | |
1254 | | - | |
1255 | | - | |
1256 | | - | |
1257 | | - | |
1258 | | - | |
1259 | | - | |
1260 | | - | |
1261 | | - | |
1262 | | - | |
1263 | | - | |
1264 | | - | |
1265 | | - | |
1266 | | - | |
1267 | | - | |
1268 | | - | |
1269 | | - | |
1270 | | - | |
1271 | | - | |
1272 | 1223 | | |
1273 | 1224 | | |
1274 | 1225 | | |
| |||
1302 | 1253 | | |
1303 | 1254 | | |
1304 | 1255 | | |
1305 | | - | |
1306 | | - | |
1307 | | - | |
1308 | | - | |
1309 | | - | |
1310 | | - | |
1311 | | - | |
1312 | | - | |
1313 | | - | |
1314 | | - | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
1315 | 1261 | | |
1316 | 1262 | | |
1317 | 1263 | | |
| |||
1355 | 1301 | | |
1356 | 1302 | | |
1357 | 1303 | | |
1358 | | - | |
1359 | | - | |
1360 | | - | |
1361 | | - | |
1362 | | - | |
1363 | | - | |
1364 | | - | |
1365 | | - | |
1366 | | - | |
1367 | | - | |
1368 | | - | |
1369 | | - | |
1370 | | - | |
1371 | | - | |
1372 | | - | |
1373 | | - | |
1374 | | - | |
1375 | | - | |
1376 | | - | |
1377 | | - | |
| 1304 | + | |
1378 | 1305 | | |
1379 | 1306 | | |
1380 | 1307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | 18 | | |
26 | 19 | | |
27 | 20 | | |
| |||
0 commit comments