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
fi3ework committed Apr 18, 2024
1 parent 611bded commit acbd96a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/ExternalModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,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 acbd96a

Please sign in to comment.