From f5ef7cd22231987a73af9f02cc5f6c80b6dbbd9b Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Fri, 22 Nov 2019 14:29:30 +0800 Subject: 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 Reviewed-By: Myles Borins --- lib/internal/modules/run_main.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') 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; -- cgit v1.2.3