From f7153a31726eb72aa1a82dd7f6115a83feda3852 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Thu, 21 Oct 2021 02:09:49 +0800 Subject: [PATCH] fix(vite): default export for external packages (#1297) --- 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 a35a1573a9..ae9ead1562 100644 --- a/packages/vite/src/dev-bundler.ts +++ b/packages/vite/src/dev-bundler.ts @@ -64,7 +64,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 => { ssrExportAll(r) })`, + code: `(global, exports, importMeta, ssrImport, ssrDynamicImport, ssrExportAll) => import('${(pathToFileURL(id))}').then(r => { exports.default = r.default; ssrExportAll(r) })`, deps: [], dynamicDeps: [] }