Skip to content

Commit cb00d34

Browse files
committed
chore: build commonjs module
1 parent 902ba3c commit cb00d34

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
/dist
77
/lib
8+
/esm
89
/tests
910
/example
1011

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
/dist
77
/lib
8+
/esm
89

910
npm-debug.log*
1011
yarn-debug.log*
11-
yarn-error.log*
12+
yarn-error.log*

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
{
22
"name": "@react-cmpt/use-throttle",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "The throttle value/function hook for react",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
7+
"module": "esm/index.js",
78
"scripts": {
8-
"build": "rm -rf ./lib/ && tsc -d --project tsconfig.json --outDir ./lib/",
9+
"build": "rm -rf ./lib ./esm && yarn build:cjs && yarn build:es",
10+
"build:cjs": "tsc",
11+
"build:es": "tsc -m ESNext --outDir ./esm",
912
"test": "jest -c jest.json",
1013
"lint": "eslint 'src/**/*.{ts,tsx}'",
1114
"prettier": "prettier --write './src/**/*.{ts,tsx}' --config ./.prettierrc",

tsconfig.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
"allowSyntheticDefaultImports": true,
44
"moduleResolution": "node",
55
"target": "es5",
6-
"module": "esnext",
6+
"module": "commonjs",
77
"strict": true,
88
"jsx": "react",
9-
"lib": ["dom", "esnext"],
10-
"sourceMap": true
9+
"lib": ["dom", "es5", "es2015"],
10+
"outDir": "./lib",
11+
"declaration": true
1112
},
1213
"include": ["src/**/*"]
1314
}

0 commit comments

Comments
 (0)