Repository navigation
Conversation
…ternals (v2) Co-Authored-By: Claude Code <noreply@anthropic.com>
|
@lx3133584 is attempting to deploy a commit to the Nitro Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
commit: |
This branch has not been 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.
Description
Resolves #4799
In Nitro 2 (
node-externals),tryResolve(id, importer)is invoked repeatedly duringresolveIdfor every bare import across all server chunks.Because
tryResolvecallsexsolve.resolveModuleURLwithfrom: [pathToFileURL(importer), ...], each chunk file path was passed as a distinct URL, preventing caching across different chunk files that reside in the same directory. In large builds (such as Nuxt apps emitting hundreds of server chunks), resolving the same bare import from the same importer directory repeatedly triggered dozens of filesystemstatSynccalls per import, dominating build times (e.g. 8 of 10 minutes on Windows).Changes
tryResolve:resolveCacheMap scoped to theexternalsplugin instance.${id}\0${fromDir}wherefromDir = importer && isAbsolute(importer) ? dirname(importer) : ""(since Node.js module resolution ancestry depends on the parent directory, all chunks in the same directory resolve bare imports identically).undefined) are memoized to avoid redundant filesystem traversal for unresolvable IDs.test/unit/externals-cache.test.tsto verify that repeated module resolutions across chunks in the same directory and repeated unresolvable module probes are memoized and invokeresolveModuleURLonly once.Verification
vitest run test/unit/externals-cache.test.tspassed (2 tests).vitest run test/unit/passed (all 18 suites, 101 tests).pnpm build(unbuild) succeeded cleanly.eslintandprettier -cpassed with 0 errors.🤖 Generated with Claude Code