diff options
Diffstat (limited to 'lib/internal/modules/cjs/loader.js')
-rw-r--r-- | lib/internal/modules/cjs/loader.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 00bc575b1f..a70fad83f9 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -717,7 +717,7 @@ Module.prototype._compile = function(content, filename) { } : undefined, }); } else { - compiledWrapper = compileFunction( + const compiled = compileFunction( content, filename, 0, @@ -736,13 +736,14 @@ Module.prototype._compile = function(content, filename) { ); if (experimentalModules) { const { callbackMap } = internalBinding('module_wrap'); - callbackMap.set(compiledWrapper, { + callbackMap.set(compiled.cacheKey, { importModuleDynamically: async (specifier) => { const loader = await asyncESM.loaderPromise; return loader.import(specifier, normalizeReferrerURL(filename)); } }); } + compiledWrapper = compiled.function; } var inspectorWrapper = null; |