-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: extract vite:resolve internal functions #12522
Conversation
Run & review this pull request in StackBlitz Codeflow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Got one suggestion below that we can do in this PR, or separately if you prefer.
const isNodeModule = | ||
nodeModulesInPathRE.test(normalizePath(id)) || | ||
nodeModulesInPathRE.test(normalizePath(resolved)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can improve this part too. We're doing simple node_modules
includes check everywhere, not sure why we special case a regex check here. We can simplify this to: id.includes('node_modules') || resolved.includes('node_modules')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah it looks like I asked the same thing last year too 🙈 #9848 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha, and I'll say the same, but this time let's do it in another PR for real 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking node_modules
alone has worked well so far for us, I don't think we need to be stricter though
Description
Extract two functions in
vite:resolve
resolveId
that are being created for every call.What is the purpose of this pull request?