Skip to content
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(resolve): fix browser mapping nearest package.json check #12550

Merged
merged 2 commits into from
Mar 23, 2023

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Mar 23, 2023

Description

We're passing a file path to findNearestPackageData which causes it to stat /Users/foo/bar.js/package.json constantly, and fs.statSync even with throwIfNoEntry throws an error in that case with ENOTDIR: not a directory, stat.

This PR ensures we're passing a dir path instead to prevent the issue, so it's one less directory to check, and no errors will happen from fs.statSync.

Additional context

This brings down my previous tests of prebundling speed, from 2s to 1.4s

(100ms comes from recent refactors from patak it seems 🎉 )


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

@bluwy bluwy added p4-important Violate documented behavior or significantly improves performance (priority) performance Performance related enhancement labels Mar 23, 2023
@stackblitz
Copy link

stackblitz bot commented Mar 23, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

patak-dev
patak-dev previously approved these changes Mar 23, 2023
@patak-dev patak-dev enabled auto-merge (squash) March 23, 2023 09:25
@patak-dev patak-dev merged commit eac376e into main Mar 23, 2023
@patak-dev patak-dev deleted the reslve-browser-perf branch March 23, 2023 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p4-important Violate documented behavior or significantly improves performance (priority) performance Performance related enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants