mirror of
https://github.com/nodejs/node.git
synced 2025-05-10 19:17:56 +00:00

And make sure that `process.argv` from the preloaded modules is the same as the one in the main module. Refs: https://github.com/nodejs/node/issues/25967 PR-URL: https://github.com/nodejs/node/pull/26000 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
22 lines
601 B
JavaScript
22 lines
601 B
JavaScript
'use strict';
|
|
|
|
const {
|
|
prepareMainThreadExecution
|
|
} = require('internal/bootstrap/pre_execution');
|
|
|
|
// Expand process.argv[1] into a full path.
|
|
const path = require('path');
|
|
process.argv[1] = path.resolve(process.argv[1]);
|
|
|
|
prepareMainThreadExecution();
|
|
|
|
const CJSModule = require('internal/modules/cjs/loader');
|
|
|
|
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();
|