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): support # in path only for dependencies #12469

Merged
merged 2 commits into from Mar 21, 2023

Conversation

patak-dev
Copy link
Member

Description

@sun0day has been investigating tryFsResolve double checks to support paths with #. See:

We added the checks to resolve the file path without removing the postfix because of dependencies like es5-ext here:

But the use of ? and # never worked in user code and this is something we can control. Requiring users to avoid ? and # in their paths is a fair price to pay to avoid double checks.

This PR formalizes that we only support # in dependencies paths, and removes the double checks in other cases. Note: I only included support for # here, and not ? so the double checks won't be triggered for every dependency.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

@stackblitz
Copy link

stackblitz bot commented Mar 17, 2023

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

@patak-dev patak-dev changed the title perf: support # in path only for dependencies perf(resolve): support # in path only for dependencies Mar 17, 2023
@patak-dev
Copy link
Member Author

/ecosystem-ci run

@patak-dev patak-dev added performance Performance related enhancement p4-important Violate documented behavior or significantly improves performance (priority) labels Mar 17, 2023
@patak-dev patak-dev added this to the 4.3 milestone Mar 17, 2023
@vite-ecosystem-ci
Copy link

vite-ecosystem-ci bot commented Mar 17, 2023

📝 Ran ecosystem CI: Open

suite result
astro ✅ success
histoire ❌ failure
iles ✅ success
ladle ✅ success
laravel ✅ success
marko ✅ success
nuxt ❌ failure
previewjs ✅ success
qwik ✅ success
rakkas ✅ success
sveltekit ❌ failure
vite-plugin-ssr ✅ success
vite-plugin-react ✅ success
vite-plugin-react-pages ✅ success
vite-plugin-react-swc ✅ success
vite-plugin-svelte ✅ success
vite-plugin-vue ✅ success
vite-setup-catalogue ✅ success
vitepress ✅ success
vitest ✅ success
windicss ✅ success

@patak-dev
Copy link
Member Author

Ecosystem CI looks fine, same fails as in main (SvelteKit latest main is failing rigth now)

bluwy
bluwy previously approved these changes Mar 17, 2023
let res: string | undefined

// if there is a postfix, try resolving it as a complete path first (#4703)
if (
Copy link
Member

@sun0day sun0day Mar 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can add some comments before each if branch. The comments tell what fsPath will hit these if conditions. It's helpful for understanding these codes quickly and refactoring them later. And I guess there are still rooms to dedupe resolve logic.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed the variable instead of adding a new comment because I think the main comment for tryUnsplitted is enough now.

@patak-dev patak-dev enabled auto-merge (squash) March 21, 2023 07:53
@patak-dev patak-dev disabled auto-merge March 21, 2023 08:40
@patak-dev patak-dev merged commit 6559fc7 into main Mar 21, 2023
18 checks passed
@patak-dev patak-dev deleted the perf/support-sharp-only-for-dependencies branch March 21, 2023 08:40
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.

None yet

3 participants