Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite dev: error stacktrace is a few lines off in dev server log #8065

Closed
hi-ogawa opened this issue Nov 20, 2023 · 1 comment
Closed

Vite dev: error stacktrace is a few lines off in dev server log #8065

hi-ogawa opened this issue Nov 20, 2023 · 1 comment

Comments

@hi-ogawa
Copy link
Contributor

hi-ogawa commented Nov 20, 2023

Reproduction

I created a reproduction with a potential user-side workaround in https://github.com/hi-ogawa/remix-vite-stacktrace-repro.
(I forked to stackblitz but it seems ssrFixStacktrace is broken on stackblitz runtime currently, so the same thing cannot be reproduced. It's not useful but just for reference https://stackblitz.com/edit/hi-ogawa-remix-vite-stacktrace-repro-yanxgp.)

I don't know about the inner working but I think currently vite ssr requires applying ssrFixStacktrace for server error. As shown in the repro, currently line/column in stacktrace is a little off without this.

I found that the best timing to apply this is already provided by handleError convention, so currently there is a user-side workaround by making use of external plugin to provide ViteDevServer instance in user code (for example, @vavite/expose-vite-dev-server or @hiogawa/vite-import-dev-server).

However, I was wondering if it would make sense to apply ssrFixStacktrace by default in remix plugin in some way.
I haven't think about how such implementation would look like yet, but I thought I would create this issue first in case other people also noticed something odd about error stack when testing remix vite.

System Info

  System:
    OS: Linux 6.6 Arch Linux
    CPU: (12) x64 AMD Ryzen 5 5625U with Radeon Graphics
    Memory: 4.78 GB / 14.98 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 18.16.0 - ~/.volta/tools/image/node/18.16.0/bin/node
    Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
    npm: 9.5.1 - ~/.volta/tools/image/node/18.16.0/bin/npm
    pnpm: 8.10.5 - ~/.asdf/installs/pnpm/8.10.5/bin/pnpm
  Browsers:
    Chromium: 119.0.6045.159
  npmPackages:
    @remix-run/dev: ^2.3.0 => 2.3.0 
    @remix-run/eslint-config: ^2.3.0 => 2.3.0 
    @remix-run/node: ^2.3.0 => 2.3.0 
    @remix-run/react: ^2.3.0 => 2.3.0 
    @remix-run/serve: ^2.3.0 => 2.3.0 
    vite: ^5.0.0 => 5.0.0 

Used Package Manager

pnpm

Expected Behavior

server error stack should be correct

Actual Behavior

server error stack is a few lines off

@hi-ogawa hi-ogawa changed the title vite: apply ViteDevServer.ssrFixStacktrace for server error by default? vite: server error stack is off a few lines (apply ViteDevServer.ssrFixStacktrace for server error by default?) Nov 20, 2023
@hi-ogawa hi-ogawa changed the title vite: server error stack is off a few lines (apply ViteDevServer.ssrFixStacktrace for server error by default?) vite: server error stack log is off a few lines (apply ViteDevServer.ssrFixStacktrace for server error by default?) Nov 20, 2023
@hi-ogawa hi-ogawa changed the title vite: server error stack log is off a few lines (apply ViteDevServer.ssrFixStacktrace for server error by default?) vite: server error stack log is a few lines off (apply ViteDevServer.ssrFixStacktrace for server error by default?) Nov 20, 2023
@hi-ogawa hi-ogawa changed the title vite: server error stack log is a few lines off (apply ViteDevServer.ssrFixStacktrace for server error by default?) vite: server error stack log is a few lines off Nov 20, 2023
@hi-ogawa hi-ogawa changed the title vite: server error stack log is a few lines off vite: error stacktrace is a few lines off in dev server log Nov 20, 2023
@hi-ogawa hi-ogawa changed the title vite: error stacktrace is a few lines off in dev server log Vite dev: error stacktrace is a few lines off in dev server log Nov 23, 2023
@markdalgleish
Copy link
Member

Fixed by #8066.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants