fix: support import.meta.resolve on Vite 7#8493
fix: support import.meta.resolve on Vite 7#8493sheremet-va merged 13 commits intovitest-dev:mainfrom
import.meta.resolve on Vite 7#8493Conversation
✅ 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.
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.
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:.