You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose you have a module, bad-module.js, which throws an error on evaluation. If you import('bad-module.js') the promise will reject, but if you load it with ssrLoadModule('bad-module.js'), the promise resolves to a module record with no exports.
This means it's difficult to know if an error occurred (especially if you don't know what shape the module should have) and impossible (AFAICT) to get hold of the error itself. For consistency, I'd expect it the error here to be rethrown:
Describe the bug
Suppose you have a module,
bad-module.js
, which throws an error on evaluation. If youimport('bad-module.js')
the promise will reject, but if you load it withssrLoadModule('bad-module.js')
, the promise resolves to a module record with no exports.This means it's difficult to know if an error occurred (especially if you don't know what shape the module should have) and impossible (AFAICT) to get hold of the error itself. For consistency, I'd expect it the error here to be rethrown:
vite/packages/vite/src/node/ssr/ssrModuleLoader.ts
Lines 111 to 120 in d0eac2f
(As an aside,
clear: true
means that theclearScreen
option isn't respected — not sure if this function has access to that config?)Reproduction
https://github.com/Rich-Harris/vite-ssr-load-errors
System Info
vite
version: 2.0.1The text was updated successfully, but these errors were encountered: