turbo
422feeb8 - Fix hang up when loading duplicated CSS module chunks (#4879)

Commit
2 years ago
Fix hang up when loading duplicated CSS module chunks (#4879) ### Description I identified this issue when authoring a test for PostCSS. Here's how it goes: 1. CSS chunk 1 loads with module chunk A and source = runtime. This marks chunk A as an available module chunk. The promise for A is the same promise as for CSS chunk 1, which is resolved in registerChunk because chunk 1 is part of the chunk group of the initial JS chunk. 2. CSS chunk 2 loads with module chunks A and B. Since A is already available, we run into a different branch, where we only try to load B. However, since we're still using source = runtime, we don't actually attempt to load B and instead return a promise to the resolver of B. But B isn't part of the chunk group of the initial JS chunk, so it is never resolved. This hangs up the runtime entirely and breaks page hydration. Instead, we move the "automatically resolving CSS chunks when source = Runtime" from `registerChunk` (which wasn't quite correct either as far as I can tell) into `loadChunk`, which solves this issue. ### Testing Instructions I don't know if it's worth having a test case just for this, but this will technically be covered under the PostCSS test case in https://github.com/vercel/next.js/pull/49463. link WEB-1023
Author
Parents
Loading