Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(openapi-fetch): bundle commonjs #1176

Merged
merged 2 commits into from
Jun 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/openapi-fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
"license": "MIT",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I’m fine with adding this, but this is more of an “invalid” / “legacy” property which was never officially standardized, which was why it was missing in the first place. It’s also not needed because it’s redundant with "main", but it’s also fine to include just in case it helps something.

"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.cjs",
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"*": "./*"
},
"homepage": "https://openapi-ts.pages.dev",
"repository": {
"type": "git",
Expand All @@ -32,10 +42,11 @@
"svelte"
],
"scripts": {
"build": "pnpm run build:clean && pnpm run build:ts && pnpm run build:ts-min",
"build": "pnpm run build:clean && pnpm run build:ts && pnpm run build:ts-min && pnpm run build:cjs",
"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",
"lint": "pnpm run lint:js",
"lint:js": "prettier --check \"{src,test}/**/*\"",
"test": "pnpm run test:ts && npm run test:js",
Expand Down