From 27b814c79b188f65ccbe9e008cbf9b7fd8ab5895 Mon Sep 17 00:00:00 2001 From: himself65 Date: Sat, 2 May 2020 22:04:51 +0800 Subject: [PATCH] module: lazy load 'getOptionValue' in initializeLoader This enables loading this module during early bootstrapping. PR-URL: https://github.com/nodejs/node/pull/33212 Reviewed-By: Guy Bedford Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Richard Lau --- lib/internal/process/esm_loader.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/process/esm_loader.js b/lib/internal/process/esm_loader.js index 996532a930496f..fe47098fde2f63 100644 --- a/lib/internal/process/esm_loader.js +++ b/lib/internal/process/esm_loader.js @@ -8,8 +8,6 @@ const { pathToFileURL } = require('internal/url'); const { getModuleFromWrap, } = require('internal/vm/module'); -const { getOptionValue } = require('internal/options'); -const userLoader = getOptionValue('--experimental-loader'); exports.initializeImportMetaObject = function(wrap, meta) { const { callbackMap } = internalBinding('module_wrap'); @@ -38,6 +36,8 @@ exports.ESMLoader = ESMLoader; exports.initializeLoader = initializeLoader; async function initializeLoader() { + const { getOptionValue } = require('internal/options'); + const userLoader = getOptionValue('--experimental-loader'); if (!userLoader) return; let cwd;