Skip to content

Commit

Permalink
Fix CJS build for TypeScript (#1360)
Browse files Browse the repository at this point in the history
* Fix cjs build for ts

* add changeset

* refactor: copy index.d.ts with cp

---------

Co-authored-by: Marco Muser <marco.muser@enpal.de>
  • Loading branch information
marcomuser and Marco Muser committed Sep 30, 2023
1 parent 60570ef commit b59e431
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-islands-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"openapi-fetch": patch
---

Fix CJS build for TypeScript
13 changes: 9 additions & 4 deletions packages/openapi-fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.cjs",
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/cjs/index.d.cts",
"default": "./dist/cjs/index.cjs"
}
},
"./*": "./*"
},
Expand Down Expand Up @@ -46,7 +51,7 @@
"build:clean": "del dist",
"build:ts": "tsc -p tsconfig.build.json",
"build:ts-min": "esbuild --bundle src/index.ts --format=esm --minify --outfile=dist/index.min.js && cp dist/index.d.ts dist/index.min.d.ts",
"build:cjs": "esbuild --bundle src/index.ts --format=cjs --outfile=dist/index.cjs",
"build:cjs": "esbuild --bundle src/index.ts --format=cjs --outfile=dist/cjs/index.cjs && cp dist/index.d.ts dist/cjs/index.d.cts",
"lint": "pnpm run lint:js",
"lint:js": "eslint \"{src,test}/**/*.{js,ts}\"",
"lint:prettier": "prettier --check \"{src,test}/**/*\"",
Expand Down

0 comments on commit b59e431

Please sign in to comment.