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
When running that reproducer with npm run dev, then going to http://localhost:3000, it triggers the stack trace. You can see that it references line 8 (example below), while the actual error is triggered on line 10.
Error: This error produces a stack trace that is incorrect.
at eval (/Users/dennisameling/repos/vite-plugin-node-stack-bug/src/server.ts:8:9)
at Layer.handle [as handle_request] (/Users/dennisameling/repos/vite-plugin-node-stack-bug/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/dennisameling/repos/vite-plugin-node-stack-bug/node_modules/express/lib/router/route.js:149:13)
at Route.dispatch (/Users/dennisameling/repos/vite-plugin-node-stack-bug/node_modules/express/lib/router/route.js:119:3)
at Layer.handle [as handle_request] (/Users/dennisameling/repos/vite-plugin-node-stack-bug/node_modules/express/lib/router/layer.js:95:5)
at /Users/dennisameling/repos/vite-plugin-node-stack-bug/node_modules/express/lib/router/index.js:284:15
at Function.process_params (/Users/dennisameling/repos/vite-plugin-node-stack-bug/node_modules/express/lib/router/index.js:346:12)
at next (/Users/dennisameling/repos/vite-plugin-node-stack-bug/node_modules/express/lib/router/index.js:280:10)
at expressInit (/Users/dennisameling/repos/vite-plugin-node-stack-bug/node_modules/express/lib/middleware/init.js:40:5)
at Layer.handle [as handle_request] (/Users/dennisameling/repos/vite-plugin-node-stack-bug/node_modules/express/lib/router/layer.js:95:5)
Potential solution
ViteDevServer has a method called ssrFixStacktrace to fix stack traces.
I'll file a PR with a fix for at least Express.
The text was updated successfully, but these errors were encountered:
When running in dev mode,
vite-plugin-node
creates incorrect stack traces. The line numbers are wrongly referenced.Reproducer
Here's a minimal reproducer: https://github.com/dennisameling/vite-plugin-node-stack-bug
When running that reproducer with
npm run dev
, then going to http://localhost:3000, it triggers the stack trace. You can see that it references line 8 (example below), while the actual error is triggered on line 10.Potential solution
ViteDevServer
has a method calledssrFixStacktrace
to fix stack traces.I'll file a PR with a fix for at least Express.
The text was updated successfully, but these errors were encountered: