Skip to content

Commit c1e00cc

Browse files
committed
Build with vite
1 parent dd49208 commit c1e00cc

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

lib/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"dist/**"
1717
],
1818
"scripts": {
19-
"build": "tsup && tsc -p tsconfig-build.json",
19+
"build": "tsc && vite build",
2020
"clean": "rm -rf dist",
2121
"dev": "tsup --watch && tsc -p tsconfig-build.json -w",
2222
"typecheck": "tsc --noEmit",
@@ -86,4 +86,4 @@
8686
"Modern",
8787
"Seamless integration"
8888
]
89-
}
89+
}

lib/tsconfig.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
2-
"extends": "@repo/typescript-config/react-library.json",
32
"compilerOptions": {
4-
"lib": ["dom", "ES2015"],
5-
"types": ["vitest", "node"]
3+
"outDir": "dist",
4+
"noEmit": false,
5+
"declaration": true,
6+
"emitDeclarationOnly": true,
7+
"declarationMap": false
68
},
7-
"include": ["."],
8-
"exclude": ["dist", "build", "node_modules"]
9+
"include": ["src"],
10+
"exclude": ["dist", "node_modules", "**/*.test.*", "**/*.spec.*"]
911
}

lib/vitest.config.ts renamed to lib/vite.config.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import { defineConfig } from "vitest/config";
2-
import react from "@vitejs/plugin-react";
32
import tsconfigPaths from "vite-tsconfig-paths";
43

54
// https://vitejs.dev/config/
65
export default defineConfig({
7-
plugins: [react(), tsconfigPaths()],
6+
plugins: [tsconfigPaths()],
7+
build: {
8+
lib: {
9+
formats: ["cjs", "es"],
10+
entry: "./src/index.ts",
11+
fileName: format => `index.${format === "es" ? "m" : ""}js`,
12+
},
13+
},
814
test: {
915
environment: "jsdom",
1016
globals: true,

0 commit comments

Comments
 (0)