소스 검색

fix(api): add top-level `main`, `module` and `types` fields (#8268)

Amr Bashir 1 년 전
부모
커밋
46451aee13
2개의 변경된 파일11개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 0
      .changes/api-top-level-main-module.md
  2. 6 3
      tooling/api/package.json

+ 5 - 0
.changes/api-top-level-main-module.md

@@ -0,0 +1,5 @@
+---
+'@tauri-apps/api': 'patch:bug'
+---
+
+Add top-level `main`, `module` and `types` fields in `package.json` to be compliant with typescripts's `"moduleResolution": "node"`

+ 6 - 3
tooling/api/package.json

@@ -19,6 +19,12 @@
   },
   "homepage": "https://github.com/tauri-apps/tauri#readme",
   "type": "module",
+  "types": "./types/index.d.ts",
+  "main": "./index.cjs",
+  "module": "./index.js",
+  "exports": {
+    "./package.json": "./package.json"
+  },
   "scripts": {
     "build": "rollup -c --configPlugin typescript",
     "npm-pack": "yarn build && cd ./dist && npm pack",
@@ -48,9 +54,6 @@
     "tslib": "2.6.2",
     "typescript": "5.2.2"
   },
-  "exports": {
-    "./package.json": "./package.json"
-  },
   "engines": {
     "node": ">= 18",
     "npm": ">= 6.6.0",