--input-type=type
这会配置 Node.js 将 --eval 或 STDIN 输入解释为 CommonJS 或 ES 模块。有效值为 "commonjs" 或 "module"。默认值是 "commonjs",除非使用了 --experimental-default-type=module。
🌐 This configures Node.js to interpret --eval or STDIN input as CommonJS or
as an ES module. Valid values are "commonjs" or "module". The default is
"commonjs" unless --experimental-default-type=module is used.
REPL 不支持此选项。在 --print 中使用 --input-type=module 会导致错误,因为 --print 不支持 ES 模块语法。
🌐 The REPL does not support this option. Usage of --input-type=module with
--print will throw an error, as --print does not support ES module
syntax.