-
-
Notifications
You must be signed in to change notification settings - Fork 1k
fix(nuxt): pass and format vite-node build errors #6683
Conversation
β Deploy Preview for nuxt3-docs canceled.
|
Thanks for PR @antfu. Please use description for next PRs even if we internally discussed ππΌ |
Added, thanks! |
Checking more locally, it seems passing main handler is not enough. Vite node (client) throws nice object with nice trace info (id, plugin, message, name, stack, loc, pluginCode, frame). Passing it up to the dev server handler, won't help. But we could pass it down to the vite-node fetch client. There I tried to restore main error object from HTTP response and throw it in What happens is: Browser request => Nitro server => SSR => Vite Node Client (Runner) => Fetch A problematic module => Gets error object. |
BTW comparing to legacy bundler, we were never handling build errors from server side but using an empty module. They were being then handled on client-side. I've just pushed 808fd5b to show how similar effect works. |
I had been testing giving error data for few cases. There is really no standard for errors coming from vite, rollup plugins and parsers such as babel used for sfc. I've made a temporary normalizer on best efforts and compatible with default error template but we should make something more standard for normalization later. Script: Template: Style: |
π Linked issue
β Type of change
π Description
To pass down the nested
h3
app's error to be handled by the main one.nodeHandler
comes with its own error handling (https://github.com/unjs/h3/blob/b95ab25575e1a6c022ff40cfd731d27cb735f621/src/app.ts#L57), changed tohandler
so it let the error flow down.π Checklist