Skip to content

Commit

Permalink
Merge pull request #11 from FilamentGames/feature/webpack-rebundle-co…
Browse files Browse the repository at this point in the history
…mpatibility

fix(webpack): Add check for existence of symbol to support rebundling by Webpack
  • Loading branch information
kalvenschraut authored Oct 4, 2023
2 parents 6d0ba28 + e7765ff commit 2b84370
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;

Expand Down

0 comments on commit 2b84370

Please sign in to comment.