.mjs 扩展
\The .mjs extension
由于 require() 的同步特性,无法使用它来加载 ECMAScript 模块文件。尝试这样做会抛出 ERR_REQUIRE_ESM 错误。改用 import()。
\Due to the synchronous nature of require(), it is not possible to use it to
load ECMAScript module files. Attempting to do so will throw a
ERR_REQUIRE_ESM error. Use import() instead.
.mjs 扩展是为 ECMAScript 模块 保留的,不能通过 require() 加载。有关哪些文件被解析为 ECMAScript 模块的更多信息,请参阅 确定模块系统 部分。
\The .mjs extension is reserved for ECMAScript Modules which cannot be
loaded via require(). See Determining module system section for more info
regarding which files are parsed as ECMAScript modules.