summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRongjian Zhang <pd4d10@gmail.com>2019-11-22 14:29:30 +0800
committerRich Trott <rtrott@gmail.com>2019-11-28 10:22:53 -0800
commitf5ef7cd22231987a73af9f02cc5f6c80b6dbbd9b (patch)
treef5385035b45fbd892b1505c342c360866b959840 /lib
parent4d73fd39489c6c2742cc16107f00dc81c7239706 (diff)
downloadandroid-node-v8-f5ef7cd22231987a73af9f02cc5f6c80b6dbbd9b.tar.gz
android-node-v8-f5ef7cd22231987a73af9f02cc5f6c80b6dbbd9b.tar.bz2
android-node-v8-f5ef7cd22231987a73af9f02cc5f6c80b6dbbd9b.zip
module: fix specifier resolution algorithm
Fixes: https://github.com/nodejs/node/issues/30520 PR-URL: https://github.com/nodejs/node/pull/30574 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/modules/run_main.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js
index 1061727c78..5f8b1f53d3 100644
--- a/lib/internal/modules/run_main.js
+++ b/lib/internal/modules/run_main.js
@@ -24,6 +24,10 @@ function shouldUseESMLoader(mainPath) {
const userLoader = getOptionValue('--experimental-loader');
if (userLoader)
return true;
+ const esModuleSpecifierResolution =
+ getOptionValue('--es-module-specifier-resolution');
+ if (esModuleSpecifierResolution === 'node')
+ return true;
// Determine the module format of the main
if (mainPath && mainPath.endsWith('.mjs'))
return true;