无 require、exports 或 module.exports
¥No require
, exports
, or module.exports
在大多数情况下,可以使用 ES 模块 import
加载 CommonJS 模块。
¥In most cases, the ES module import
can be used to load CommonJS modules.
如果需要,可以使用 module.createRequire()
在 ES 模块中构造 require
函数。
¥If needed, a require
function can be constructed within an ES module using
module.createRequire()
.