summaryrefslogtreecommitdiff
path: root/lib/internal/main/run_main_module.js
diff options
context:
space:
mode:
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]);