-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
p2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)
Description
Describe the bug
When importing anything from bun, Vitest v4 throws an error:
src:
import { $ } from 'bun';
export async function example() {
await $`echo hi`;
}error:
Error: Failed to resolve entry for package "bun". The package may have incorrect main/module/exports specified in its package.json.
Plugin: vite:import-analysisIn Vitest v3, this code worked fine (I suspect because the calls to bun were mocked away), but in v4 it no longer works. Looking at the bun package.json it's a valid error... (there is no entry script). But I'm not sure if this check is useful here as we're never actually importing the file...
Mocking out the file that uses this import does not help, nor does mocking bun itself 😭
Reproduction
https://stackblitz.com/edit/vitejs-vite-j93mxww4?file=src%2Fenv.test.ts
System Info
System:
OS: macOS 26.1
CPU: (12) arm64 Apple M3 Pro
Memory: 500.44 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.11.1 - /Users/matthew.gladman/.volta/tools/image/node/24.11.1/bin/node
npm: 11.6.4 - /Users/matthew.gladman/.volta/tools/image/npm/11.6.4/bin/npm
bun: 1.3.4 - /Users/matthew.gladman/projects/catalogue-verse/node_modules/.bin/bun
Browsers:
Chrome: 143.0.7499.41
Edge: 143.0.3650.80
Firefox: 145.0.1
Safari: 26.1Used 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.
Metadata
Metadata
Assignees
Labels
p2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)
Type
Projects
Status
P2 - 3