Skip to content

mThreads/vmForks pool crashes with ERR_MODULE_NOT_FOUND when deps.optimizer.client.enabled is true #10657

Description

@SveLil

Describe the bug

This is a variation of #9899
I'm doing exactly the same as is described there, I also get the same error message. I'm using vitest 4.1.9

Reproduction

// vitest.config.ts
import { defineConfig } from 'vitest/config';

export default defineConfig({
  test: {
    environment: 'happy-dom',
    pool: 'vmThreads', // also fails with 'vmForks'
    deps: {
      optimizer: {
        client: {
          enabled: true,
          include: ['react', 'react-dom'],
        },
      },
    },
  },
});
// example.test.ts
import { expect, test } from 'vitest';
test('basic', () => { expect(1 + 1).toBe(2); });

Run:

vitest run

The difference to #9899 is that the ? is escape in the URL, and therefore the fix isn't working:

node_modules/vitest/dist/spy.js%3Fv=1c38a1aa

System Info

vitest 4.1.9
vite 8.0.10
node 24.16.0
npm 11.13.0
OS Linux 6.8 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat)
pool vmThreads / vmForks (both affected)
environment jsdom (also reproducible with happy-dom)
  System:
    OS: Linux 6.8 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat)
    CPU: (22) x64 Intel(R) Core(TM) Ultra 7 155H
    Memory: 8.25 GB / 30.85 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 24.16.0 - ~/.nvm/versions/node/v24.16.0/bin/node
    npm: 11.13.0 - ~/.nvm/versions/node/v24.16.0/bin/npm
    pnpm: 10.11.0 - /run/user/731821679/fnm_multishells/2261290_1782132283535/bin/pnpm
  Browsers:
    Chrome: 149.0.7827.114
    Chromium: 149.0.7827.53
  npmPackages:
    @vitejs/plugin-react: ^6.0.1 => 6.0.1 
    @vitest/coverage-v8: ^4.1.9 => 4.1.9 
    @vitest/ui: ^4.1.9 => 4.1.9 
    vitest: ^4.1.9 => 4.1.9 
    vitest-sonar-reporter: 3.0.0 => 3.0.0 

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions