Skip to content

Commit 798219d

Browse files
committed
module: exclude node:ffi from builtinModules when flag is disabled
Module.builtinModules is supposed to only list modules that are accessible to user code. node:ffi requires --experimental-ffi to be required, so filter it out when the flag is not set, mirroring the existing handling for --experimental-quic. Refs: #63137 (comment)
1 parent 1b04f16 commit 798219d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lib/internal/modules/cjs/loader.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,9 @@ function initializeCJS() {
490490
if (!getOptionValue('--experimental-quic')) {
491491
modules = modules.filter((i) => i !== 'node:quic');
492492
}
493+
if (!getOptionValue('--experimental-ffi')) {
494+
modules = modules.filter((i) => i !== 'node:ffi');
495+
}
493496
Module.builtinModules = ObjectFreeze(modules);
494497

495498
initializeCjsConditions();

0 commit comments

Comments
 (0)