diff options
author | Shelley Vohr <shelley.vohr@gmail.com> | 2020-06-26 04:07:37 +0300 |
---|---|---|
committer | Shelley Vohr <shelley.vohr@gmail.com> | 2020-06-29 19:12:11 +0300 |
commit | c23d2fd3f8a018bcc624f1468a9ce176f6ce93f2 (patch) | |
tree | 4f868038dc77b7eb64d091ee55ae59729293a0b8 /lib/internal/bootstrap | |
parent | 9e135accbb045d52eb65de602c81b5090daae1c4 (diff) |
src: allow embedders to disable esm loader
PR-URL: https://github.com/nodejs/node/pull/34060
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'lib/internal/bootstrap')
-rw-r--r-- | lib/internal/bootstrap/pre_execution.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js index f60814d2dc9..a51dbf05ec4 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -6,7 +6,10 @@ const { SafeWeakMap, } = primordials; -const { getOptionValue } = require('internal/options'); +const { + getOptionValue, + shouldNotRegisterESMLoader +} = require('internal/options'); const { Buffer } = require('buffer'); const { ERR_MANIFEST_ASSERT_INTEGRITY } = require('internal/errors').codes; const assert = require('internal/assert'); @@ -56,7 +59,10 @@ function prepareMainThreadExecution(expandArgv1 = false) { initializeDeprecations(); initializeWASI(); initializeCJSLoader(); - initializeESMLoader(); + + if (!shouldNotRegisterESMLoader) { + initializeESMLoader(); + } const CJSLoader = require('internal/modules/cjs/loader'); assert(!CJSLoader.hasLoadedAnyUserCJSModule); |