"imports"


// package.json
{
  "imports": {
    "#dep": {
      "node": "dep-node-native",
      "default": "./dep-polyfill.js"
    }
  },
  "dependencies": {
    "dep-node-native": "^1.0.0"
  }
}

导入字段中的条目必须是以 # 开头的字符串。

导入映射允许映射到外部包。

此字段为当前包定义了子路径导入

// package.json
{
  "imports": {
    "#dep": {
      "node": "dep-node-native",
      "default": "./dep-polyfill.js"
    }
  },
  "dependencies": {
    "dep-node-native": "^1.0.0"
  }
}

Entries in the imports field must be strings starting with #.

Import maps permit mapping to external packages.

This field defines subpath imports for the current package.