Skip to content

Commit

Permalink
fix: support both ESM and CJS via tsup
Browse files Browse the repository at this point in the history
  • Loading branch information
duniul committed Oct 23, 2023
1 parent b5d0879 commit d4b4e68
Show file tree
Hide file tree
Showing 7 changed files with 710 additions and 23 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-keys-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'trim-image-data': patch
---

Support both ESM and CJS.
File renamed without changes.
30 changes: 22 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,12 @@
"crop-image",
"trim-image"
],
"main": "lib/cjs/index.js",
"module": "lib/es/index.js",
"files": [
"lib/**"
"dist/**"
],
"scripts": {
"build": "rimraf lib && pnpm build:es && pnpm build:cjs",
"build:es": "tsc --outDir lib/es --module es6",
"build:cjs": "tsc --outDir lib/cjs --module commonjs",
"dev": "rimraf lib && pnpm build:es --watch",
"build": "tsup",
"dev": "tsup --watch",
"test": "vitest",
"prepublishOnly": "pnpm build",
"lint": "biome check",
Expand All @@ -43,14 +39,32 @@
"devDependencies": {
"@biomejs/biome": "1.3.1",
"@canvas/image-data": "1.0.0",
"@tsconfig/node16": "^16.1.1",
"@types/sharp": "0.31.1",
"changesets-changelog-clean": "1.2.1",
"husky": "8.0.3",
"lint-staged": "15.0.2",
"prettier": "3.0.3",
"prettier-plugin-organize-imports": "3.2.3",
"sharp": "0.32.6",
"tsup": "^7.2.0",
"typescript": "5.2.2",
"vitest": "^0.34.6"
}
},
"type": "module",
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}
},
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.cts"
}
Loading

0 comments on commit d4b4e68

Please sign in to comment.