Skip to content

Commit

Permalink
module: lazy load 'getOptionValue' in initializeLoader
Browse files Browse the repository at this point in the history
This enables loading this module during early bootstrapping.

PR-URL: #33212
Reviewed-By: Guy Bedford <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
  • Loading branch information
himself65 authored and codebytere committed May 11, 2020
1 parent 5b42d81 commit 27b814c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/internal/process/esm_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 27b814c

Please sign in to comment.