summaryrefslogtreecommitdiff
path: root/lib/internal/main/run_main_module.js
diff options
context:
space:
mode:
authorBradley Farias <bfarias@godaddy.com>2019-09-30 14:55:59 -0500
committerGuy Bedford <guybedford@gmail.com>2019-10-16 21:50:05 -0400
commita6b030d5ac2c4a2d34f6b9eb3f945d252a42843e (patch)
treedfd91dad91d60e90e39db3b5326d509c32a62f5f /lib/internal/main/run_main_module.js
parent1784b7fafac2755f870db3de9eb45a754b7a6477 (diff)
downloadandroid-node-v8-a6b030d5ac2c4a2d34f6b9eb3f945d252a42843e.tar.gz
android-node-v8-a6b030d5ac2c4a2d34f6b9eb3f945d252a42843e.tar.bz2
android-node-v8-a6b030d5ac2c4a2d34f6b9eb3f945d252a42843e.zip
module: refactor modules bootstrap
PR-URL: https://github.com/nodejs/node/pull/29937 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'lib/internal/main/run_main_module.js')
-rw-r--r--lib/internal/main/run_main_module.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/internal/main/run_main_module.js b/lib/internal/main/run_main_module.js
index 2cad569dcc..77d997b97a 100644
--- a/lib/internal/main/run_main_module.js
+++ b/lib/internal/main/run_main_module.js
@@ -10,8 +10,7 @@ const CJSModule = require('internal/modules/cjs/loader').Module;
markBootstrapComplete();
-// Note: this actually tries to run the module as a ESM first if
-// --experimental-modules is on.
-// TODO(joyeecheung): can we move that logic to here? Note that this
-// is an undocumented method available via `require('module').runMain`
-CJSModule.runMain();
+// Note: this loads the module through the ESM loader if
+// --experimental-loader is provided or --experimental-modules is on
+// and the module is determined to be an ES module
+CJSModule.runMain(process.argv[1]);