-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: support import.meta.resolve on Vite 7
#8493
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: support import.meta.resolve on Vite 7
#8493
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
| public moduleExecutionInfo: ModuleExecutionInfo | ||
|
|
||
| constructor(private options: VitestModuleRunnerOptions) { | ||
| constructor(private vitestOptions: VitestModuleRunnerOptions) { |
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.
The base class ModuleRunner also has options property, which later accessed for this.options.createImportMeta
https://github.com/vitejs/vite/blob/84079a84ad94de4c1ef4f1bdb2ab448ff2c01196/packages/vite/src/module-runner/runner.ts#L342-L343. To avoid crashing the properly, I needed to rename this.
3a8f6b0 to
add181d
Compare
This reverts commit 31c6142.
| state, | ||
| evaluatedModules: state.evaluatedModules, | ||
| spyModule, | ||
| createImportMeta: createNodeImportMeta, |
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 made it explicitly passed via startVitestModuleRunner since otherwise createNodeImportMeta would break @vitest/web-worker on vm since module.register is not supported there. Such limitation might exist for other custom runner (e.g. cloudflare), so making this as opt-in is probably better.
This reverts commit add181d.
|
Hi, I'm using Edit: fixed with explicitly adding |
Description
import.meta.resolveis broken in vite-node, despite working in node #6953import.meta.resolve#5188 (supersedes)Since Vite 7.1, module runner implements
import.meta.resolvevia custom node loader vitejs/vite#20260.TODO
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.