Subtle change in Vite runtime stacktrace with prepareStackTrace
since 5.1.5
#16178
Closed
7 tasks done
Labels
feat: sourcemap
Sourcemap support
p3-minor-bug
An edge case that only affects very specific usage (priority)
regression
The issue only appears after a new release
Describe the bug
While upgrading Vite from 5.1.0 to 5.1.6 on my monorepo with vite-node-miniflare hi-ogawa/vite-plugins#198, I found my tests which asserts stacktrace are failing. On further investigation, there seems to be a subtle difference since 5.1.5 as seen in this simpler reproduction.
node run.mjs ./repro-entry.ts ... Error: crash ssr at crash (.../repro-entry.ts:2:9) at main (.../repro-entry.ts:6:9) <---- 6:3 became 6:9 since 5.1.5
On my actual case, I use a plugin
vitePluginSimpleHmr
which adds one more transform to ssr code, then stacktrace seems more broken (not only column, but also line and absolute path resolution is not working). For this part, there might be an issue with my plugin, so I'm not sure whether it's related to Vite side change and I haven't tried minimal repro for that yet.Reproduction
https://github.com/hi-ogawa/reproductions/tree/main/vite-runtime-stacktrace-5.1.5
Steps to reproduce
In the reproduction, I added a comparison with node and also when vite entry is plain javascript, in which case there's no difference in stacktrace.
Stackblitz doesn't seem to have a good support on stacktrace, so it might be necessary to copy the reproduction locally. To skip cloning the entire repo, you can use tools such as https://github.com/tiged/tiged
System Info
Used Package Manager
npm
Logs
This is the same content as reproduction readme, but just in case:
Validations
The text was updated successfully, but these errors were encountered: