mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
module: remove useCustomLoadersIfPresent flag
The flag is always true and can be determined by isLoaderWorker solely. PR-URL: https://github.com/nodejs/node/pull/48655 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
parent
996239b0be
commit
6b7197cb2b
@ -524,15 +524,13 @@ let emittedLoaderFlagWarning = false;
|
||||
* A loader instance is used as the main entry point for loading ES modules. Currently, this is a singleton; there is
|
||||
* only one used for loading the main module and everything in its dependency graph, though separate instances of this
|
||||
* class might be instantiated as part of bootstrap for other purposes.
|
||||
* @param {boolean} useCustomLoadersIfPresent If the user has provided loaders via the --loader flag, use them.
|
||||
* @returns {ModuleLoader}
|
||||
*/
|
||||
function createModuleLoader(useCustomLoadersIfPresent = true) {
|
||||
function createModuleLoader() {
|
||||
let customizations = null;
|
||||
if (useCustomLoadersIfPresent &&
|
||||
// Don't spawn a new worker if we're already in a worker thread created by instantiating CustomizedModuleLoader;
|
||||
// doing so would cause an infinite loop.
|
||||
!require('internal/modules/esm/utils').isLoaderWorker()) {
|
||||
if (!require('internal/modules/esm/utils').isLoaderWorker()) {
|
||||
const userLoaderPaths = getOptionValue('--experimental-loader');
|
||||
if (userLoaderPaths.length > 0) {
|
||||
if (!emittedLoaderFlagWarning) {
|
||||
|
@ -11,10 +11,10 @@ let esmLoader;
|
||||
|
||||
module.exports = {
|
||||
get esmLoader() {
|
||||
return esmLoader ??= createModuleLoader(true);
|
||||
return esmLoader ??= createModuleLoader();
|
||||
},
|
||||
async loadESM(callback) {
|
||||
esmLoader ??= createModuleLoader(true);
|
||||
esmLoader ??= createModuleLoader();
|
||||
try {
|
||||
const userImports = getOptionValue('--import');
|
||||
if (userImports.length > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user