From 6f1f12af1696d4ab503402417368da84d3a0e103 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 4 Nov 2021 18:18:36 +0000 Subject: [PATCH] fix(vite): expose underlying import errors (#1696) --- packages/vite/src/dev-bundler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/dev-bundler.ts b/packages/vite/src/dev-bundler.ts index fc2e47a6ae..9c4379c817 100644 --- a/packages/vite/src/dev-bundler.ts +++ b/packages/vite/src/dev-bundler.ts @@ -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: [] }