next.js
b694eeb5 - Turbopack: only compute module ids for included modules (#93276)

Commit
169 days ago
Turbopack: only compute module ids for included modules (#93276) Currently doesn't have a measureable performance impact. Previously we assigned module ids for all nodes in the graph, even the subgraphs we detect as unused. They weren't chunked already, but the codegen that references those wasn't gracefully handling `.chunk_item_id(m)` failing (where `m` is a unused skipped module) So `.iter_nodes()` should basically be deprecated. It doesn't respect `removed_unused_imports` and the side-effect-free inference. And this would get much much worse once NFT is on the module graph, because then there are way more modules that should be skipped via the same mechanism This manifested as the following error after switching from `.iter_nodes` to `.traverse_edges_unordered` in global_module_ids.rs ``` Debug info: - An error occurred while generating the chunk item [project]/node_modules/.pnpm/next@file+..+next.js+packages+next_@babel+core@7.29.0_@opentelemetry+api@1.7.0_@playwri_9a8ea08672cbf59c2720abbb0c8879be/node_modules/next/dist/esm/server/stream-utils/node-web-streams-helper.js [app-rsc] (ecmascript) - Execution of <MergedEcmascriptModule as EcmascriptChunkPlaceable>::chunk_item_content failed - Execution of *EcmascriptChunkItemContent::new failed - Execution of EcmascriptModuleContent::new_merged failed - ModuleId not found for ident: [project]/node_modules/.pnpm/next@file+..+next.js+packages+next_@babel+core@7.29.0_@opentelemetry+api@1.7.0_@playwri_9a8ea08672cbf59c2720abbb0c8879be/node_modules/next/dist/esm/shared/lib/hash.js [app-rsc] (ecmascript) ```
Author
Parents
Loading