vitest-dev / vitest-dev/vitest
Browser mode throws "Failed to fetch dynamically imported module"
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17.1k
- Forks
- 2k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 94
Description
Describe the bug
I'm in the process of comparing all of the test runners on a very basic vue 3 composition API + TS app. So i setup testing lib and a basic test, it worked. Then I tried to add @vitest/browser and I updated vitest.config.ts to use playwright and chromium but vitest started errors like
ReferenceError: Vue is not defined
Reproduction
I haven't seen this error anywhere else but I reproduced it in StackBlitz, the setup is fairly similar to the one on my machine and gives the same result
https://stackblitz.com/edit/vitest-dev-vitest-urjsz7
Could it be a setup error on my part ? Or is it a bug ?
System Info
System:
OS: macOS 14.3
CPU: (8) arm64 Apple M2
Memory: 532.70 MB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.14.2 - ~/.nvm/versions/node/v18.14.2/bin/node
npm: 9.5.0 - ~/.nvm/versions/node/v18.14.2/bin/npm
pnpm: 8.15.3 - /opt/homebrew/bin/pnpm
bun: 1.1.0 - ~/.bun/bin/bun
Browsers:
Chrome: 123.0.6312.87
Safari: 17.3
npmPackages:
@vitejs/plugin-vue: ^4.6.2 => 4.6.2
@vitest/browser: ^1.4.0 => 1.4.0
@vitest/ui: ^1.4.0 => 1.4.0
vite: ^4.5.3 => 4.5.3
vitest: ^1.4.0 => 1.4.
Used 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked StackBlitz reproduction and inspect vitest.config.ts, focusing on @vitest/browser with Playwright and Chromium in the Vue 3 TypeScript app. Run the browser test to reproduce the dynamic-import failure and Vue is not defined error; done means the same setup runs without either error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- playwright, typescript, vite
- Domain
- frontend, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100