diff options
Diffstat (limited to 'lib/internal/modules/cjs/loader.js')
-rw-r--r-- | lib/internal/modules/cjs/loader.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 51adba6086..8ef01b4499 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -31,6 +31,7 @@ const { } = primordials; const { NativeModule } = require('internal/bootstrap/loaders'); +const { maybeCacheSourceMap } = require('internal/source_map'); const { pathToFileURL, fileURLToPath, URL } = require('internal/url'); const { deprecate } = require('internal/util'); const vm = require('vm'); @@ -845,7 +846,9 @@ Module.prototype.require = function(id) { var resolvedArgv; let hasPausedEntry = false; -function wrapSafe(filename, content) { +function wrapSafe(filename, content, cjsModuleInstance) { + maybeCacheSourceMap(filename, content, cjsModuleInstance); + if (patched) { const wrapper = Module.wrap(content); return vm.runInThisContext(wrapper, { @@ -910,7 +913,7 @@ Module.prototype._compile = function(content, filename) { manifest.assertIntegrity(moduleURL, content); } - const compiledWrapper = wrapSafe(filename, content); + const compiledWrapper = wrapSafe(filename, content, this); var inspectorWrapper = null; if (getOptionValue('--inspect-brk') && process._eval == null) { |