import 语句


¥import statements

import 语句可以引用 ES 模块或 CommonJS 模块。import 语句只允许在 ES 模块中使用,但 CommonJS 支持动态 import() 表达式来加载 ES 模块。

¥An import statement can reference an ES module or a CommonJS module. import statements are permitted only in ES modules, but dynamic import() expressions are supported in CommonJS for loading ES modules.

导入 CommonJS 模块 时,module.exports 对象作为默认导出提供。命名导出可能可用,由静态分析提供,以方便更好的生态系统兼容性。

¥When importing CommonJS modules, the module.exports object is provided as the default export. Named exports may be available, provided by static analysis as a convenience for better ecosystem compatibility.