Uh oh!
There was an error while loading. Please reload this page.
fix(nuxt): pass and format vite-node build errors - #6683
Conversation
✅ Deploy Preview for nuxt3-docs canceled.
|
pi0
commented
Aug 16, 2022
Thanks for PR @antfu. Please use description for next PRs even if we internally discussed 🙏🏼 |
antfu
commented
Aug 16, 2022
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. |
pi0
commented
Aug 16, 2022
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. |
Uh oh!
There was an error while loading. Please reload this page.
pi0
commented
Sep 3, 2022
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
h3app's error to be handled by the main one.nodeHandlercomes with its own error handling (https://github.com/unjs/h3/blob/b95ab25575e1a6c022ff40cfd731d27cb735f621/src/app.ts#L57), changed tohandlerso it let the error flow down.📝 Checklist