fix(vite): expose underlying import errors (#1696)

This commit is contained in:
Daniel Roe 2021-11-04 18:18:36 +00:00 committed by GitHub
parent 9b8d44d130
commit 6f1f12af16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,7 +71,7 @@ async function transformRequest (opts: TransformOptions, id: string) {
if (await isExternal(opts, id)) {
return {
code: `(global, exports, importMeta, ssrImport, ssrDynamicImport, ssrExportAll) => import('${(pathToFileURL(id))}').then(r => { exports.default = r.default; ssrExportAll(r) })`,
code: `(global, exports, importMeta, ssrImport, ssrDynamicImport, ssrExportAll) => import('${(pathToFileURL(id))}').then(r => { exports.default = r.default; ssrExportAll(r) }).catch(e => { console.error(e); throw new Error('[vite dev] Error loading external "${id}".') })`,
deps: [],
dynamicDeps: []
}