Skip to content

Some errors related to pre-bundled vitest on browser mode on 5.0.0-beta.7 #10836

Description

@hi-ogawa

I was testing beta in standalone repro and found two issues. Likely due to #10713

Reproduction: https://github.com/hi-ogawa/reproductions/tree/main/vitest-10729-browser-locator-optimize

  • It fails without vite installed at the project:
~/.local/share/ho-dev-notes/vitest/pr-10729-external-browser-repro $ pnpm test --run
$ vitest run --run

 RUN  v5.0.0-beta.7 /Users/hogawa/.local/share/ho-dev-notes/vitest/pr-10729-external-browser-repro
      API started at http://localhost:63315/

2:50:12 PM [vite] (client) Pre-transform error: Failed to resolve import "vite/module-runner" from "node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/deps/index.CLtI1k_4-HUooSsSw.js?v=6667e1ac". Does the file exist?
  Plugin: vite:import-analysis
  File: /Users/hogawa/.local/share/ho-dev-notes/vitest/pr-10729-external-browser-repro/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/deps/index.CLtI1k_4-HUooSsSw.js?v=6667e1ac:5:34
  3  |  import { Bench as $ } from "./tinybench.js";
  4  |  import { $ as getType, A as processError, C as getFn, D as onTestFailed, E as matchesTags, F as test, G as getSafeTim...
  5  |  import { EvaluatedModules } from "vite/module-runner";
     |                                    ^
  6  |  //#region node_modules/.pnpm/vitest@5.0.0-beta.7_@vitest+browser-playwright@5.0.0-beta.7_@vitest+ui@5.0.0-beta.7_vite...
  7  |  var NAME_WORKER_STATE = "__vitest_worker__";
2:50:12 PM [vite] Internal server error: Failed to resolve import "vite/module-runner" from "node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/deps/index.CLtI1k_4-HUooSsSw.js?v=6667e1ac". Does the file exist?
  • After installing vite, it shows @vitest/browser/client warning on first run.
~/code/personal/reproductions/vitest-10729-browser-locator-optimize $ rm -rf node_modules/.vite
~/code/personal/reproductions/vitest-10729-browser-locator-optimize $ pnpm test
✓ Lockfile passes supply-chain policies (verified 1m ago)
Lockfile is up to date, resolution step is skipped
Already up to date
Done in 226ms using pnpm v11.15.1
$ vitest run
Failed to resolve dependency: @vitest/browser/client, present in client 'optimizeDeps.include'

 RUN  v5.0.0-beta.7 /Users/hogawa/code/personal/reproductions/vitest-10729-browser-locator-optimize
      API started at http://localhost:63315/
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions