Skip to content

Doesn't support vitest workspaces #13331

Closed
@lishaduck

Description

@lishaduck

Describe the bug

When trying to use @sveltejs/kit in a monorepo that uses Vitest workspaces, SvelteKit fails to resolve its peer dependency @sveltejs/vite-plugin-svelte.

Reproduction

https://github.com/lishaduck/svk-vitest-repro

Run pnpm i && pnpm vitest (from root)

Logs

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Startup Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: Could not resolve peer dependency "@sveltejs/vite-plugin-svelte" relative to your project — please install it and try again.
    at resolve_peer_dependency (file:///Users/dukese01/Developer/psdtools.github.io/node_modules/.pnpm/@sveltejs+kit@2.15.3_@sveltejs+vite-plugin-svelte@5.0.3_svelte@5.18.0_vite@6.0.7_@types_68510af3441b04c6bc21b13c7b195734/node_modules/@sveltejs/kit/src/utils/import.js:16:9)
    at sveltekit (file:///Users/dukese01/Developer/psdtools.github.io/node_modules/.pnpm/@sveltejs+kit@2.15.3_@sveltejs+vite-plugin-svelte@5.0.3_svelte@5.18.0_vite@6.0.7_@types_68510af3441b04c6bc21b13c7b195734/node_modules/@sveltejs/kit/src/exports/vite/index.js:157:27)

System Info

System:
    OS: macOS 14.7.2
    CPU: (8) arm64 Apple M1
    Memory: 104.83 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 23.6.0 - /opt/homebrew/bin/node
    npm: 10.9.2 - /opt/homebrew/bin/npm
    pnpm: 10.0.0 - ~/.nvm/versions/node/v22.10.0/bin/pnpm
    Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 132.0.6834.84
    Safari: 18.2
  npmPackages:
    @sveltejs/adapter-static: ^3.0.8 => 3.0.8 
    @sveltejs/kit: ^2.0.0 => 2.15.3 
    @sveltejs/vite-plugin-svelte: ^5.0.3 => 5.0.3 
    svelte: ^5.0.0 => 5.18.0 
    vite: ^6.0.7 => 6.0.7

Severity

serious, but I can work around it

Additional Information

By "work around it", I mean, I can skip tests.

Originally found in a Vite 6 + Vitest 3 project, but the repro is Vite 5 + Vitest 3. Haven't tried Vitest 2 (because I'm using the new way of configuring workspaces in Vitest 3)

I use pnpm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions