Repository navigation
fix(externals): keep per-version ids for traced externals imported from bundled code - #4740
Merged
Merged
Conversation
…om bundled code Traced externals resolved to different versions were emitted with the same bare specifier, so bundled importers silently shared one version. Use the nf3 output layout to import non-hoisted versions by path. Resolves #4731.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
⛔ Files ignored due to path filters (5)
📒 Files selected for processing (4)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
pi0
approved these changes
Oct 7, 2026
commit: |
Merged
2 of 8 tasks
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #4731
When bundled modules import the same traced external but resolve different versions of it (e.g. app →
bcrypt@1, bundled workspace package → nestedbcrypt@2), the externals plugin returned the bare specifier for both. The bundler merged the imports, so in production both sides silently got whichever version was hoisted.Changes
nf3to^0.4.1, which returns the traced output layout and hoists the version that resolves fromrootDir(feat: return traced output layout and hoist rootDir-resolvable version unjs/nf3#76).resolveId, each traced external gets a unique placeholder id per resolved file, so imports of different versions are no longer merged.renderChunk, each placeholder is rendered from the nf3 layout:node_modules/<name>(output unchanged in the common case)node_modules/.nf3/<name>@<version>/...)test/fixture/node_modules/nitro-bundled-dep(bundled) imports its own nested@fixture/[email protected], while the app imports the root2.0.0.Example output (rolldown):
🤖 Generated with AI assistant