From e7765ff339cc129f82d8e95b2667f3b88b5edbd1 Mon Sep 17 00:00:00 2001 From: Alex Stone Date: Tue, 3 Oct 2023 17:13:25 -0500 Subject: [PATCH] Add check for existance of symbol to support rebundling by Webpack --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index e6110eb..9e1e6f7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -103,7 +103,7 @@ async function replaceImports (fileContents: string, resolveDir: string, config: // remove the extra comma added and add the closing bracket and semicolon objectMapString = objectMapString.replace(/.$/, '};'); - const importFunctionString = `function _DynamicImport(path) {const mod=_DynamicImportModuleMap[path];mod[Symbol.toStringTag]='Module';return Promise.resolve(mod); }`; + const importFunctionString = `function _DynamicImport(path) {const mod=_DynamicImportModuleMap[path];if(!mod[Symbol.toStringTag]) mod[Symbol.toStringTag]='Module';return Promise.resolve(mod); }`; const jsStr = `${importString}\n${objectMapString}\n${importFunctionString}\n`;