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): default extensions review #12470
Conversation
Run & review this pull request in StackBlitz Codeflow. |
I think the I'm in favour of having Removing |
Good point, is it even defined what happen in this case? If node picks one of the two first, we should do that too.
My thought was that it may be more common to avoid the extension for
I'll check. I don't expect the diff being that big but it is still a lot of checks. If you see cases like #12471, we are first failing all these checks before testing the real path for aliased absolute paths. I think the diff may become smaller though if we keep optimizing other the resolve plugin. Conceptually though, why are we treating |
Node seems to completely ignore
I think it's equally common :D I usually go JS-only and I omit extensions in a Vite project too.
I think it's because we handle |
I reduced the scope of the PR to only the order change. If we would like to explore removing the default JSX, we should do it later on in a different change (I'm not sure we should though). Also reduced the reordering to leave |
Closing the PR for now, I think that @bluwy has a point about |
Description
Edit: this is no longer a breaking change. I reduced the scope of the PR to only the order change.
This is a breaking change targeting Vite 5. Sending a PR to start a discussion.
Current default resolve extensions are:
Projects using Vite and JSX (React or Solid) need to include the corresponding framework plugin. These plugins could inject
.jsx
and.tsx
toextensions
for their users. So we could reduce the number of default extensions to check from 7 to 5 for Vue, Svelte, and other frameworks that don't use these extensions.The current order could also be reviewed. We could resolve first
.ts
instead of.js
as it is probably more common when the extension is missing. Most projects using ESM modules are going to use"type": "module"
and.js
instead of.mjs
.This PR proposes a new default value for
extensions
:What is the purpose of this pull request?