Skip to content

repl: do not define `wasi` on global with no flag

Rodrigo Muino Tomonari requested to merge github/fork/cola119/fix-45560 into main

Fixes #45560 (closed)

In the REPL, prepareMainThreadExecution that updates the canBeRequiredByUsers flag of wasi module according to the flag is called after the internal/process/esm_loader.js load that creates builtinModules depending on the module.canBeRequiredByUsers flag. In this case, wasi.canBeRequiredByUsers is always true so wasi module always can be required by users even if the flag is not set.

https://github.com/nodejs/node/blob/2a7635feb226f410433d2c6e20699ced7a250be1/lib/internal/modules/cjs/loader.js#L217-L223

Merge request reports

Loading