Skip to content

Commit

Permalink
fix: only render init code when need moduleRemapping
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Apr 22, 2024
2 parents 4b50219 + acbd96a commit 1542e11
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/ExternalModule.js
Expand Up @@ -333,13 +333,15 @@ const getSourceForModuleExternal = (
let expression = moduleRemapping || baseAccess;
return {
expression,
init: `var x = ${runtimeTemplate.basicFunction(
"y",
`var x = {}; ${RuntimeGlobals.definePropertyGetters}(x, y); return x`
)} \nvar y = ${runtimeTemplate.returningFunction(
runtimeTemplate.returningFunction("x"),
"x"
)}`,
init: moduleRemapping
? `var x = ${runtimeTemplate.basicFunction(
"y",
`var x = {}; ${RuntimeGlobals.definePropertyGetters}(x, y); return x`
)} \nvar y = ${runtimeTemplate.returningFunction(
runtimeTemplate.returningFunction("x"),
"x"
)}`
: undefined,
runtimeRequirements: moduleRemapping
? RUNTIME_REQUIREMENTS_FOR_MODULE
: undefined,
Expand Down

0 comments on commit 1542e11

Please sign in to comment.