Open hi-ogawa opened 1 month ago
I think the new behavior is fine.
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)
The broken stack might be due to stackblitz's runtime? https://github.com/stackblitz/webcontainer-core/issues/1240
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
Used Package Manager
pnpm
Logs
No response
Validations