From d30170ee618e13c961536d1745b94ed6f4ebfa9e Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 7 Nov 2021 21:16:20 +0100 Subject: [PATCH] Recognize {... as default } construction in vite plugin --- packages/bridge/src/vite/plugins/default-export.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bridge/src/vite/plugins/default-export.ts b/packages/bridge/src/vite/plugins/default-export.ts index 52ec342f8bc..c41f2b21405 100644 --- a/packages/bridge/src/vite/plugins/default-export.ts +++ b/packages/bridge/src/vite/plugins/default-export.ts @@ -6,7 +6,7 @@ const PREFIX = 'defaultexport:' const hasPrefix = (id: string = '') => id.startsWith(PREFIX) const removePrefix = (id: string = '') => hasPrefix(id) ? id.substr(PREFIX.length) : id -const hasDefaultExport = (code: string = '') => code.includes('export default') +const hasDefaultExport = (code: string = '') => code.match(/export (default|.* as default)/g) const addDefaultExport = (code: string = '') => code + '\n\n' + 'export default () => {}' export function defaultExportPlugin () {