导出的语法糖


如果 "." 导出是唯一的导出,则 "exports" 字段为这种情况提供了语法糖,即直接的 "exports" 字段值。

{
  "exports": {
    ".": "./index.js"
  }
}

可以写成:

{
  "exports": "./index.js"
}

If the "." export is the only export, the "exports" field provides sugar for this case being the direct "exports" field value.

{
  "exports": {
    ".": "./index.js"
  }
}

can be written:

{
  "exports": "./index.js"
}