Skip to content

fix(ssr): preserve fetchModule error details#18626

Merged
patak-cat merged 1 commit intovitejs:mainfrom
hi-ogawa:fix-runner-fetchModule-rollup-error
Nov 11, 2024
Merged

fix(ssr): preserve fetchModule error details#18626
patak-cat merged 1 commit intovitejs:mainfrom
hi-ogawa:fix-runner-fetchModule-rollup-error

Conversation

@hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented Nov 9, 2024

Description

While investigating the other fix #18621, I realized new transport (introduced in #18362) is not preserving some error properties such as RollupError.loc, frame, which is useful for error overlay.

Error overlay screenshots

image

image

name: error.name,
message: error.message,
stack: error.stack,
...error, // preserve enumerable properties such as RollupError.loc, frame, plugin
Copy link
Contributor Author

@hi-ogawa hi-ogawa Nov 9, 2024

Choose a reason for hiding this comment

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

Alternatively we can return Error instance directly { e: error } and let each transport implementation deal with it. This works for default ssr runner, but for others using JSON.stringify, it'll end up empty since JSON.stringify(new Error("hmm")) === '{}', so it's certainly a minor inconvenience for them.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 9, 2024

Open in Stackblitz

pnpm add https://pkg.pr.new/vite@18626

commit: dd1a756

@hi-ogawa hi-ogawa marked this pull request as ready for review November 9, 2024 03:01
@sapphi-red sapphi-red added feat: ssr p4-important Violate documented behavior or significantly improves performance (priority) labels Nov 11, 2024
@patak-cat patak-cat merged commit 866a433 into vitejs:main Nov 11, 2024
moonlitusun pushed a commit to moonlitusun/vite that referenced this pull request May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: ssr p4-important Violate documented behavior or significantly improves performance (priority) trigger: preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants