子路径文件夹映射


🌐 Subpath folder mappings

稳定性: 0 - 已弃用:请改用子路径模式。

在子路径模式支持之前,后尾的“/”后缀被用于 支持文件夹映射:

🌐 Before subpath patterns were supported, a trailing "/" suffix was used to support folder mappings:

{
  "exports": {
    "./features/": "./features/"
  }
} 

此功能将在未来版本中被移除.

🌐 This feature will be removed in a future release.

相反,使用直接 子路径模式

🌐 Instead, use direct subpath patterns:

{
  "exports": {
    "./features/*": "./features/*.js"
  }
} 

相较于文件夹导出,使用模式的好处是,消费者总是可以导入包,而不需要子路径文件扩展名。

🌐 The benefit of patterns over folder exports is that packages can always be imported by consumers without subpath file extensions being necessary.