Skip to content

Commit b54bc5d

Browse files
committed
build: bundle cjs
1 parent 6f6b8b9 commit b54bc5d

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
cjs
33
esm
4+
types

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
"license": "MIT",
55
"packageManager": "[email protected]",
66
"type": "commonjs",
7-
"types": "./cjs/index.d.ts",
7+
"types": "./types/index.d.ts",
88
"exports": {
99
".": {
10-
"types": "./cjs/index.d.ts",
10+
"types": "./types/index.d.ts",
1111
"import": "./esm/index.mjs",
1212
"require": "./cjs/index.js"
1313
},
1414
"./cjs": {
15-
"types": "./cjs/index.d.ts",
15+
"types": "./types/index.d.ts",
1616
"import": "./cjs/index.js",
1717
"require": "./cjs/index.js"
1818
},
1919
"./esm": {
20-
"types": "./cjs/index.d.ts",
20+
"types": "./types/index.d.ts",
2121
"import": "./esm/index.mjs",
2222
"require": "./esm/index.mjs"
2323
}
@@ -33,7 +33,9 @@
3333
},
3434
"scripts": {
3535
"prepublishOnly": "npm run build",
36-
"build": "tsc && esbuild src/index.ts --bundle --format=esm --outfile=esm/index.mjs",
36+
"build": "tsc && npm run build:esm && npm run build:cjs",
37+
"build:esm": "esbuild src/index.ts --bundle --format=esm --outfile=esm/index.mjs",
38+
"build:cjs": "esbuild src/index.ts --bundle --format=cjs --outfile=cjs/index.js",
3739
"test": "vitest run"
3840
},
3941
"devDependencies": {

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
"lib": [ "ES2021" ],
55
"module": "CommonJS",
66
"declaration": true,
7+
"emitDeclarationOnly": true,
78
"strict": true,
89
"noUnusedLocals": true,
910
"noUnusedParameters": true,
1011
"skipLibCheck": true,
1112
"isolatedDeclarations": true,
1213
"rootDir": "src",
13-
"outDir": "cjs",
14+
"outDir": "types",
1415
},
1516
"include": [ "src" ],
1617
}

0 commit comments

Comments
 (0)