-
-
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
fix(config): don't use module
condition (fixes #10430)
#10495
Conversation
module
conditionmodule
condition (fixes #10430)
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.
I've also been thinking of a few ways to fix this, and this is much much elegant!
} | ||
const absolutePath = path.resolve(importer, '..', result.path) |
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.
const absolutePath = path.resolve(importer, '..', result.path) | |
const absolutePath = path.resolve(path.dirname(importer), result.path) |
I'm not sure if it makes a difference, but I usually use path.dirname
. But the ..
trick here seems to work too.
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
@sapphi-red vite-plugin-ssr and SvelteKit are also failing in main, but the Vitest fail seems to be related to this PR 🤔 |
Could we add a test to ensure we don't revert #10430 in the future? |
It seems Vitest is failing because esbuild uses Sure. I'll add tests when we decided the approach. 👍 @bluwy What way did you have in mind? |
You might hate me for this, but I really like the esbuild solution, but otherwise we may have to use |
That's neat. But unfortunately I guess that will break scripts using |
Hmm yeah maybe an alternative for now is to go with no1. The initial idea I had was to introduce a If it happens to be a lot of work, |
superseded by #10528 |
Description
node does not use
module
condition. But Vite was using that when bundling (replacing specifier with absolute path) config.This PR uses esbuild to resolve specifier instead of Vite's internal resolver.
I came up with three solutions for this.
noModuleCondition
option to vite's internal resolver and use that for config bundling (similar to fix(config): don't resolve by exports.module field #10442)import.meta.resolve
/import-meta-resolve
(ponyfill)import-meta-resolve
is only 63.3kB and adding this won't affect the package size much. We could perfectly imitate node's resolver by using this. But I think we could just use esbuild's resolver as it's reliable enough and could be more performant.superseds #10442
fixes #10430
refs #10254 #10347 #10420
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).