Skip to content

Commit 2c5992b

Browse files
committed
feat: Publish ESM, alongside CJS
1 parent c8c979f commit 2c5992b

File tree

5 files changed

+746
-9
lines changed

5 files changed

+746
-9
lines changed

.prettierrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module.exports = {
1+
export default {
22
singleQuote: true,
33
};

package.json

+18-5
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,26 @@
1818
"author": "Andrei Picus",
1919
"license": "MIT",
2020
"homepage": "https://github.com/NiGhTTraX/react-mock-component",
21-
"main": "dist/index",
22-
"types": "dist/index",
21+
"type": "module",
22+
"main": "./dist/index.cjs",
23+
"module": "./dist/index.js",
24+
"types": "./dist/index.d.ts",
25+
"exports": {
26+
"import": {
27+
"types": "./dist/index.d.ts",
28+
"import": "./dist/index.js"
29+
},
30+
"require": {
31+
"types": "./dist/index.d.cts",
32+
"require": "./dist/index.cjs"
33+
}
34+
},
2335
"files": [
2436
"dist"
2537
],
2638
"scripts": {
27-
"build": "pnpm run clean && pnpm run compile",
28-
"clean": "rm -rf ./dist",
29-
"compile": "tsc -p tsconfig.build.json",
39+
"build": "tsup src/index.tsx --format cjs,esm --dts --clean --tsconfig tsconfig.build.json",
40+
"check-types": "attw --pack .",
3041
"prepublishOnly": "pnpm run build",
3142
"release": "standard-version",
3243
"lint": "eslint --quiet .",
@@ -42,6 +53,7 @@
4253
"react-dom": "^18.0.0 || ^19.0.0"
4354
},
4455
"devDependencies": {
56+
"@arethetypeswrong/cli": "~0.17.1",
4557
"@eslint/js": "~9.16.0",
4658
"@testing-library/dom": "~10.4.0",
4759
"@testing-library/react": "~16.1.0",
@@ -59,6 +71,7 @@
5971
"react": "~19.0.0",
6072
"react-dom": "~19.0.0",
6173
"standard-version": "~9.5.0",
74+
"tsup": "~8.3.5",
6275
"typescript": "~5.7.0",
6376
"typescript-eslint": "~8.17.0",
6477
"vitest": "~2.1.8"

0 commit comments

Comments
 (0)