注入的主脚本的模块格式


🌐 Module format of the injected main script

要指定 Node.js 应该如何解释注入的主脚本,请在单一可执行应用配置中使用 mainFormat 字段。接受的值有:

🌐 To specify how Node.js should interpret the injected main script, use the mainFormat field in the single-executable application configuration. The accepted values are:

  • "commonjs":注入的主脚本被视为一个 CommonJS 模块。
  • "module":注入的主脚本被视为 ECMAScript 模块。

如果未指定 mainFormat 字段,则默认为 "commonjs"

🌐 If the mainFormat field is not specified, it defaults to "commonjs".

目前,"mainFormat": "module" 不能与 "useSnapshot" 一起使用。

🌐 Currently, "mainFormat": "module" cannot be used together with "useSnapshot".