-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Vitest 4.x internal typescript error with Vite <=7.1.0 #9055
Copy link
Copy link
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
Vitest 4.x lists "vite": "^6.0.0 || ^7.0.0" as a dependency, but if you use any version of vite before v7.1.0, TypeScript errors with:
node_modules/vitest/dist/chunks/moduleRunner.d.BxT-OjLR.d.ts:174:74 - error TS2339: Property 'createImportMeta' does not exist on type 'ModuleRunnerOptions'.
174 type CreateImportMeta = NonNullable<viteModuleRunner.ModuleRunnerOptions["createImportMeta"]>;
~~~~~~~~~~~~~~~~~~
Note that this only happens if the vitest.config.ts file is included in the TypeScript context.
Reproduction
System Info
System:
OS: macOS 15.7.2
CPU: (14) arm64 Apple M4 Pro
Memory: 524.47 MB / 48.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.11.1 - /Users/<redacted>/.nvm/versions/node/v24.11.1/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 11.6.2 - /Users/<redacted>/.nvm/versions/node/v24.11.1/bin/npm
Watchman: 2025.04.21.00 - /run/current-system/sw/bin/watchman
Browsers:
Firefox: 145.0
Firefox Developer Edition: 145.0
Safari: 26.1
npmPackages:
vite: 7.0.4 => 7.0.4
vitest: 4.0.10 => 4.0.10Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)