特性


🌐 Features

默认解析器具有以下属性:

🌐 The default resolver has the following properties:

  • 基于文件 URL 的解析,如 ES 模块所使用
  • 相对和绝对 URL 解析
  • 没有默认扩展
  • 没有主文件夹
  • 通过 node_modules 进行裸指定符包解析查找
  • 不会因未知的扩展或协议而失败
  • 可以选择在加载阶段提供格式提示

默认加载器具有以下属性

🌐 The default loader has the following properties

  • 通过 node: URL 支持内置模块加载
  • 通过 data: URL 支持“内联”模块加载
  • 支持 file: 模块加载
  • 在任何其他 URL 协议上都会失败
  • 在加载 file: 时对未知扩展名失败(仅支持 .cjs.js.mjs

当启用 --experimental-package-map 标志时,裸引用解析会先查看包映射配置。如果导入的模块位于映射的包中,并且引用与声明的依赖匹配,则包映射解析优先。详情请见 封装地图

🌐 When the --experimental-package-map flag is enabled, bare specifier resolution first consults the package map configuration. If the importing module is within a mapped package and the specifier matches a declared dependency, the package map resolution takes precedence. See Package maps for details.