fix(ssr): pretty print plugin error in ssrLoadModule
#19290
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
js_parse_error
being thrown. sveltejs/vite-plugin-svelte#1069Though this might look like a regression from the before/after screenshots below, this error was never pretty-printed. What's happening in sveltekit's repro is that, a plugin error of
ssrLoadModule
entry transform was outside thistry/catch
, so sveltekit were able totry/catch
and pretty print on their own with "Internal server error" on Vite 5. Since Vite 6, entry level transform also goes through runner, so any plugin error will be caught through "Error when evaluating SSR module" message.Currently this automatic logging is fairly verbose and no error pretty printing. I'm not sure what to do with an extra
runnerError
(maybe make it non-enumerable?), but for now, doing pretty print probably helps the situation a bit and that's what I did it in this PR.Screenshots
before (vite 5)
https://www.sveltelab.dev/wwj9l72l4etmdhg
before (vite 6)
https://www.sveltelab.dev/o2e6wq4d900igtk
after (this pr)
https://www.sveltelab.dev/r04dodmlt1ekx5n