You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On v5, when error occurs during ssrLoadModule, it logs error for each import from entry to where the error happened, for example:
$ node repro.mjs
1:11:30 PM [vite] Error when evaluating SSR module /src/dep3.js:
|- Error: something bad
at eval (/home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/src/dep3.js:3:20)
at instantiateModule (file:///home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52650:11)
1:11:30 PM [vite] Error when evaluating SSR module /src/dep2.js:
|- Error: something bad
at eval (/home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/src/dep3.js:3:20)
at instantiateModule (file:///home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52650:11)
1:11:30 PM [vite] Error when evaluating SSR module /src/dep1.js:
|- Error: something bad
at eval (/home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/src/dep3.js:3:20)
at instantiateModule (file:///home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52650:11)
1:11:30 PM [vite] Error when evaluating SSR module /src/entry:
|- Error: something bad
at eval (/home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/src/dep3.js:3:20)
at instantiateModule (file:///home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52650:11)
This is not the case on v6 and the error would look like:
$ node repro.mjs
1:12:18 PM [vite] (ssr) Error when evaluating SSR module /src/entry:
|- Error: something bad
at eval (/home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/src/dep3.js:3:20)
at ESModulesEvaluator.runInlinedModule (file:///home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/module-runner.js:1065:6)
at ModuleRunner.directRequest (file:///home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/module-runner.js:1038:82)
at ModuleRunner.cachedRequest (file:///home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/module-runner.js:947:28)
at request (file:///home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/module-runner.js:984:116)
at async eval (/home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/src/dep2.js:3:44)
at async ESModulesEvaluator.runInlinedModule (file:///home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/module-runner.js:1057:5)
at async ModuleRunner.directRequest (file:///home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/module-runner.js:1038:61)
at async ModuleRunner.cachedRequest (file:///home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/module-runner.js:948:76)
at async eval (/home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/src/dep1.js:3:44)
There is a similar information available in stacktrace, but it's probably limited what it can show. I'm wondering whether v6 should do similar logging (though error logs on v5 can be too verbose so maybe that should be discussed as well).
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
One thing that might be good to improve would be to remove ESModulesEvaluator.runInlinedModule/ModuleRunner.directRequest/ModuleRunner.cachedRequest/request from the stacktrace.
Then the stacktrace will be like:
$ node repro.mjs
1:12:18 PM [vite] (ssr) Error when evaluating SSR module /src/entry:
|- Error: something bad
at eval (/home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/src/dep3.js:3:20)
at async eval (/home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/src/dep2.js:3:44)
at async eval (/home/hiroshi/code/personal/reproductions/vite-v6-ssr-error/src/dep1.js:3:44)
Hmm, it seems fixStacktrace: true is not working in this repro.
The following error happens if I add , { fixStacktrace: true } to server.ssrLoadModule.
node repro.mjs
Error: `line` must be greater than 0 (lines start at line 1)
at async ModuleLoader.import (https://vbwimjlralgithub-3s0r.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:154:2688)
at async loadESM (https://vbwimjlralgithub-3s0r.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:184:541)
at async handleMainPromise (https://vbwimjlralgithub-3s0r.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:165:296)
Describe the bug
On v5, when error occurs during
ssrLoadModule
, it logs error for each import from entry to where the error happened, for example:This is not the case on v6 and the error would look like:
There is a similar information available in stacktrace, but it's probably limited what it can show. I'm wondering whether v6 should do similar logging (though error logs on v5 can be too verbose so maybe that should be discussed as well).
Reproduction
https://github.com/hi-ogawa/reproductions/tree/main/vite-v6-ssr-error
Steps to reproduce
node repro.mjs
System Info
System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 18.20.3 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.2.3 - /usr/local/bin/npm pnpm: 8.15.6 - /usr/local/bin/pnpm npmPackages: vite: 6.0.0-alpha.19 => 6.0.0-alpha.19
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: