0
点赞
收藏
分享

微信扫一扫

Remix IDE 快速开始Starknet

老北京的热干面 2023-12-08 阅读 62
  • module: 字段指定了 ES 模块版本的入口文件路径,
  • main: 字段则指定了 CommonJS 模块版本的入口文件路径。
  • exports 字段:
    • 作用: exports 字段是 Node.js 12+ 版本引入的,它用于指定模块的导出规则,允许你定义模块的多个入口。
    • 用法: exports 字段可以用来指定模块的入口文件,允许你为不同的环境提供不同的入口。它支持多种格式,例如:
    • 注意: 目前 exports 字段在 Node.js 环境中得到较好的支持,但在其他环境中的兼容性可能有限。
{
  "name": "hex-event-track",
  "version": "1.0.4",
  "description": "",
  "type": "module",
  "scripts": {
    "build": "tsup --global-name globalHexEventTrack",
    "watch": "tsup --watch --global-name globalHexEventTrack",
    "test": "vitest -u"
  },
  "keywords": [
    "hexfuture event track"
  ],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@types/ua-parser-js": "^0.7.37",
    "eslint": "^8.46.0",
    "tsup": "^7.2.0",
    "typescript": "^5.1.6",
    "vitest": "^0.34.4"
  },
  "files": [
    "dist",
    "src"
  ],
  "types": "./dist/index.d",
  "main": "./dist/index.js",
  "exports": {
    ".": {
      "import": "./dist/index.js",
      "require": "./dist/index.cjs"
    }
  },
  "repository": {
    "type": "git"
  },
  "dependencies": {
    "ua-parser-js": "^1.0.36"
  }
}

遇到的问题

我在使用老版本vuecli时遇到了不识别exports字段的问题。需要加上 main 字段

举报

相关推荐

0 条评论