Skip to content

Commit 3acafb8

Browse files
committed
Fix tsup config
1 parent 462e4f0 commit 3acafb8

File tree

4 files changed

+11
-19
lines changed

4 files changed

+11
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"test": "vitest --run",
3939
"test:watch": "vitest --watch",
4040
"typecheck": "tsc --noEmit",
41-
"build": "tsup",
41+
"build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
4242
"prepack": "yarn typecheck && yarn lint && yarn test && yarn build"
4343
},
4444
"prettier": {

tsconfig.build.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"extends": "./tsconfig.json",
33
"include": ["src"],
4-
"exclude": ["__tests__"]
4+
"exclude": ["__tests__"],
5+
"compilerOptions": { "noEmit": false }
56
}

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"lib": ["DOM", "DOM.Iterable", "ES2019"],
77
"jsx": "react",
88
"moduleResolution": "Node",
9+
"outDir": "dist/",
910

1011
"allowJs": false,
1112
"declaration": true,

tsup.config.ts

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
1-
import { Options, defineConfig } from "tsup";
1+
import { defineConfig } from "tsup";
22

3-
const commonOptions: Partial<Options> = {
3+
export default defineConfig({
44
entry: { index: "src/index.ts" },
5-
tsconfig: "./tsconfig.build.json",
5+
format: ["cjs", "esm"],
66
target: "es2019",
7+
tsconfig: "./tsconfig.build.json",
8+
clean: true,
9+
dts: false,
710
sourcemap: true,
811
treeshake: true,
9-
};
10-
11-
export default defineConfig([
12-
{
13-
...commonOptions,
14-
clean: true,
15-
format: "esm",
16-
},
17-
{
18-
...commonOptions,
19-
dts: true,
20-
format: "cjs",
21-
},
22-
]);
12+
});

0 commit comments

Comments
 (0)