From d79208a2cc62149bf5a96dbbce784d7173b9dac7 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Wed, 25 Sep 2024 12:07:00 +0200 Subject: [PATCH] fixup! module: unflag --experimental-require-module --- lib/internal/modules/esm/utils.js | 6 ++---- .../es-module-loaders/loader-with-custom-condition.mjs | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/internal/modules/esm/utils.js b/lib/internal/modules/esm/utils.js index 2799af0f8dd492..99061e62976e7c 100644 --- a/lib/internal/modules/esm/utils.js +++ b/lib/internal/modules/esm/utils.js @@ -75,17 +75,15 @@ function initializeDefaultConditions() { const userConditions = getOptionValue('--conditions'); const noAddons = getOptionValue('--no-addons'); const addonConditions = noAddons ? [] : ['node-addons']; - + const moduleConditions = getOptionValue('--experimental-require-module') ? ['module-sync'] : []; defaultConditions = ObjectFreeze([ 'node', 'import', + ...moduleConditions, ...addonConditions, ...userConditions, ]); defaultConditionsSet = new SafeSet(defaultConditions); - if (getOptionValue('--experimental-require-module')) { - defaultConditionsSet.add('module-sync'); - } } /** diff --git a/test/fixtures/es-module-loaders/loader-with-custom-condition.mjs b/test/fixtures/es-module-loaders/loader-with-custom-condition.mjs index 3aefed51d57d3e..90c55fa576bb3c 100644 --- a/test/fixtures/es-module-loaders/loader-with-custom-condition.mjs +++ b/test/fixtures/es-module-loaders/loader-with-custom-condition.mjs @@ -5,6 +5,7 @@ export async function resolve(specifier, context, defaultResolve) { deepStrictEqual([...context.conditions].sort(), [ 'import', + 'module-sync', 'node', 'node-addons', ]);