启用
Node.js 有两个模块系统:CommonJS 模块和 ECMAScript 模块。
作者可以通过 .mjs 文件扩展名、package.json "type" 字段、或 --input-type 标志告诉 Node.js 使用 ECMAScript 模块加载器。
在这些情况之外,Node.js 将使用 CommonJS 模块加载器。
参阅确定模块系统了解更多详细信息。
Node.js has two module systems: CommonJS modules and ECMAScript modules.
Authors can tell Node.js to use the ECMAScript modules loader
via the .mjs file extension, the package.json "type" field, or the
--input-type flag. Outside of those cases, Node.js will use the CommonJS
module loader. See Determining module system for more details.