Environment
- Nitro: nitro-nightly latest
- Node: 24.8.0
- pnpm: 10.18.0
- Vite: 7.1.9
Reproduction
I have a new tanstack start app with turborepo + pnpm, nitro v3 plugin in vite config, and nodeLinker: hoisted in pnpm-workspace.yaml
Describe the bug
When using pnpm with nodeLinker: hoisted, Vite SSR fails to resolve Node.js built-in imports (node:events) in node-mock-http when Nitro v3 Vite plugin is enabled. This seems to be caused by the hoisted layout changing how dependencies are resolved and externalized. The full error is pasted below.
Additional context
No response
Logs
Error: Failed to load url node:events (resolved id: node:events) in /home/wovw/work/st-cloud/node_modules/node-mock-http/dist/index.mjs. Does the file exist?
at loadAndTransform (file:///home/wovw/work/st-cloud/node_modules/vite/dist/node/chunks/dep-CuuNgwUk.js:26143:33) {
code: 'ERR_LOAD_URL',
runnerError: Error: RunnerError
at reviveInvokeError (file:///home/wovw/work/st-cloud/node_modules/vite/dist/node/module-runner.js:474:64)
at Object.invoke (file:///home/wovw/work/st-cloud/node_modules/vite/dist/node/module-runner.js:547:11)
at ModuleRunner.getModuleInformation (file:///home/wovw/work/st-cloud/node_modules/vite/dist/node/module-runner.js:1053:7)
at request (file:///home/wovw/work/st-cloud/node_modules/vite/dist/node/module-runner.js:1070:83)
at /home/wovw/work/st-cloud/node_modules/node-mock-http/dist/index.mjs:1:1
at ESModulesEvaluator.runInlinedModule (file:///home/wovw/work/st-cloud/node_modules/vite/dist/node/module-runner.js:906:3)
at ModuleRunner.directRequest (file:///home/wovw/work/st-cloud/node_modules/vite/dist/node/module-runner.js:1113:59)
at ModuleRunner.cachedRequest (file:///home/wovw/work/st-cloud/node_modules/vite/dist/node/module-runner.js:1031:73)
at /home/wovw/work/st-cloud/node_modules/h3/dist/index.mjs:8:1
at ESModulesEvaluator.runInlinedModule (file:///home/wovw/work/st-cloud/node_modules/vite/dist/node/module-runner.js:906:3)
}
Environment
Reproduction
I have a new tanstack start app with turborepo + pnpm, nitro v3 plugin in vite config, and
nodeLinker: hoistedinpnpm-workspace.yamlDescribe the bug
When using pnpm with
nodeLinker: hoisted, Vite SSR fails to resolve Node.js built-in imports (node:events) in node-mock-http when Nitro v3 Vite plugin is enabled. This seems to be caused by the hoisted layout changing how dependencies are resolved and externalized. The full error is pasted below.Additional context
No response
Logs