Turbopack: refactor export analysis#92781
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Tests Passed |
Merging this PR will improve performance by 4.84%
Performance Changes
Comparing Footnotes
|
6f01c2f to
fae0c19
Compare
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📎 Tarball URL |
2bec518 to
dcee9c4
Compare
24026b7 to
90504c4
Compare
dcee9c4 to
8d10b14
Compare
af22a46 to
41c3115
Compare
8d10b14 to
f2a7456
Compare
f2a7456 to
f269df3
Compare
41c3115 to
b6cf70e
Compare
f269df3 to
a3e2efd
Compare
The refactor moved import handling to a prepass but dropped the case where
an import has no specifiers but has an internal turbopack part ID (e.g.
`import "__TURBOPACK_PART__" with { ... }`). Without this, the tree-shaken
facade loses its dependency on the ModuleEvaluation part, causing side
effects to not execute.
Co-Authored-By: Claude <noreply@anthropic.com>
Two fixes in imports.rs:
1. Re-exports (export { x } from '...') should always have mutable=false
since liveness is determined by the referenced module's own export
description, not the re-exporting module. The refactor incorrectly
propagated is_fake_esm to the mutable flag for re-exports, causing
setter functions to be emitted where getters are sufficient.
2. The snapshot source-map offsets shifted by 4 lines due to the above
change; regenerate the 5 affected basic-tree-shake snapshots.
Co-Authored-By: Claude <noreply@anthropic.com>
a3e2efd to
d323ca1
Compare
| let issue_source = self | ||
| .source | ||
| .map(|s| IssueSource::from_swc_offsets(s, span.lo.to_u32(), span.hi.to_u32())); |
There was a problem hiding this comment.
nit: would it make sense to defer constructing this (capture the span instead) the span is 8 bytes but an issueSource is more like 40 and all these ImportMapReferences are for the same source file
| DefaultDecl::TsInterfaceDecl(_) => { | ||
| // not matching, might happen due to eventual consistency | ||
| ( | ||
| magic_identifier::mangle("default export").into(), |
There was a problem hiding this comment.
nit: we reference this in many places, should we have a shared constant? i think it could be rcstr!(mangle("default export") also if we mark mangle as a const fn

Remove
ModuleReferencesVisitorand move everything into theImportMapAnalyzer