Description
Issue Type
- Bug Report
- Was successfully reproduced against the latest version of NW.js
Current/Missing Behavior
the node>22.x flag --experimental-require-module
can't seem to be used on NW.js .
Using either in package.json
:
"node-main": "--experimental-require-module"
Or with the CLI ./nw.exe --experimental-require-module
The error thrown when require() is used in the app is require() of ES Module
. Using the same flag with node (and not NWjs!!) gives the error require() cannot be used on an ESM graph with top-level await. Use import() instead.
Which makes me believe that the flag, although present in process.execArgv
and detected by node in CLI, is never actually used by NW.js.
Expected/Proposed Behavior
Passing the experimental flag --experimental-require-module
(which is no longer needed in node>23.x, BTW, but that flag thing might be deeper than just that? Idk.) should activate the require() of ES Modules.
Additional Info
Tests were done using require('webtorrent')
(v.2.5.7, which is an async ES module) either in node (working but throws an async error, which is expected) or in NW.js' devtools (not working at all)
- Operating System: Windows 11 x64 24H2
- NW.js Version: 0.93.0-sdk