Skip to content

fix(ssr): align named export function call stacktrace column with Node - #22829

Merged
sapphi-red merged 2 commits into
mainfrom
fix/ssr-align-named-export-function-call-stacktrace-column-with-node
Jul 9, 2026
Merged

sapphi-red merged 2 commits into
mainfrom
fix/ssr-align-named-export-function-call-stacktrace-column-with-node

Conversation

@sapphi-red

Copy link
Copy Markdown
Member

It seems we can align this behavior by tweaking some mappings.

fixes #19625

@sapphi-red sapphi-red added feat: ssr p2-edge-case Bug, but has workaround or limited in scope (priority) feat: sourcemap Sourcemap support labels Jun 30, 2026
@sapphi-red

ghost commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

/ecosystem-ci run

@pkg-pr-new

ghost commented Jun 30, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/plugin-legacy

pnpm add https://pkg.pr.new/@vitejs/plugin-legacy@22829 -D
npm i https://pkg.pr.new/@vitejs/plugin-legacy@22829 -D
yarn add https://pkg.pr.new/@vitejs/plugin-legacy@22829.tgz -D

vite

pnpm add https://pkg.pr.new/vite@22829 -D
npm i https://pkg.pr.new/vite@22829 -D
yarn add https://pkg.pr.new/vite@22829.tgz -D

commit: 2388d44

@vite-ecosystem-ci

ghost commented Jun 30, 2026

Copy link
Copy Markdown

@sapphi-red
sapphi-red marked this pull request as ready for review July 1, 2026 01:30

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice trick 👍

@sapphi-red
sapphi-red requested a review from hi-ogawa July 3, 2026 03:34

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So cool!
Had struggled to understand the idea, so I had AI visualize the mapping 😃 https://artifacts.hiro18181.workers.dev/vite-pr-22829

Comment on lines +375 to +381
// V8 anchors the call-site stack frame of a parenthesized callee to
// the argument list `(`. Absorb everything from the callee up to the
// first argument (or the call's end for an empty argument list) into
// the replaced chunk so that `(` maps back to the start of the callee,
// keeping stack trace columns aligned with Node (which points to the
// callee). Optional calls (`?.()`) are excluded because Node itself
// anchors them to the `(`. See #19625.

ghost Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how much trusted but AI said this adjustment happens here https://github.com/v8/v8/blob/0c7a9d0d8c05491e8053d7259a1a6b11e75c1907/src/parsing/parser-base.h#L4037-L4043

The comment calls out the case of IIFE function(){}(), but parenthesized case seems to also hit this case.

Also, it looks like bun isn't affected (and already correct) since they already have different callee mapping approach that doesn't rely on argument list (.

@sapphi-red

ghost commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

Had struggled to understand the idea, so I had AI visualize the mapping 😃 https://artifacts.hiro18181.workers.dev/vite-pr-22829

Cool! What prompt did you use to generate this page?

@hi-ogawa

ghost commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Had struggled to understand the idea, so I had AI visualize the mapping 😃 https://artifacts.hiro18181.workers.dev/vite-pr-22829

Cool! What prompt did you use to generate this page?

I have some some personal skills in https://github.com/hi-ogawa/dotfiles/tree/main/skills and this was mostly a combination of ho-review then ho-artifact. I used opencode with anthropic/claude-opus-4-8.


Full session transcript is https://gist.github.com/hi-ogawa/8f306058811eab7bd85244aeaab3fc6e and I prompted this after review:

can you visualize the mapping fix idea? perhas before and after which how column maps?

@hi-ogawa

ghost commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

I confirmed the change on Vitest vitest-dev/vitest#10722. It looks like CI is failing for other reason between 8.0.11 to 8.1.3 though vitest-dev/vitest#10723

@sapphi-red

ghost commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

#22484 and #22695 had some sourcemap changes so that might be related

@hi-ogawa

ghost commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Turns out Vitest CI fails is because of a Vitest bug. It's being fixed in vitest-dev/vitest#10724.
This PR should be good to merge.

@sapphi-red

ghost commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

/ecosystem-ci run

@vite-ecosystem-ci

ghost commented Jul 9, 2026

Copy link
Copy Markdown

@sapphi-red
sapphi-red merged commit 173a1b6 into main Jul 9, 2026
@sapphi-red
sapphi-red deleted the fix/ssr-align-named-export-function-call-stacktrace-column-with-node branch July 9, 2026 04:13
@hi-ogawa hi-ogawa mentioned this pull request Jul 14, 2026
1 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: sourcemap Sourcemap support feat: ssr p2-edge-case Bug, but has workaround or limited in scope (priority) trigger: preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vite module runner call stack column is slightly different from Node

3 participants