diff options
author | Michaël Zasso <targos@protonmail.com> | 2020-05-16 17:31:15 +0300 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2020-07-14 16:21:26 +0300 |
commit | 05539c166a331b9b37925239cb8cef1dc923387a (patch) | |
tree | 849b6ea1d217866cb98ebc832d14c0dc71e68cd2 /lib/internal/modules | |
parent | 4195c31ecbb83f07d5a8bda579f13e139aface1a (diff) |
repl: support --loader option in builtin REPL
Fixes: https://github.com/nodejs/node/issues/33435
PR-URL: https://github.com/nodejs/node/pull/33437
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib/internal/modules')
-rw-r--r-- | lib/internal/modules/run_main.js | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js index 5f8b1f53d33..0967ef539ca 100644 --- a/lib/internal/modules/run_main.js +++ b/lib/internal/modules/run_main.js @@ -40,21 +40,10 @@ function shouldUseESMLoader(mainPath) { function runMainESM(mainPath) { const esmLoader = require('internal/process/esm_loader'); const { pathToFileURL } = require('internal/url'); - const { hasUncaughtExceptionCaptureCallback } = - require('internal/process/execution'); - return esmLoader.initializeLoader().then(() => { + esmLoader.loadESM((ESMLoader) => { const main = path.isAbsolute(mainPath) ? pathToFileURL(mainPath).href : mainPath; - return esmLoader.ESMLoader.import(main); - }).catch((e) => { - if (hasUncaughtExceptionCaptureCallback()) { - process._fatalException(e); - return; - } - internalBinding('errors').triggerUncaughtException( - e, - true /* fromPromise */ - ); + return ESMLoader.import(main); }); } |