-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
48 lines (45 loc) · 1.1 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/// <reference types="vitest" />
import { glob } from "glob";
import { fileURLToPath } from "node:url";
import { UserConfig, defineConfig } from "vite";
import dts from "vite-plugin-dts";
import pkg from "./package.json" assert { type: "json" };
const sourceDir = fileURLToPath(new URL("./src", import.meta.url));
export default defineConfig(async () => {
const inputs = await glob("**/*.ts?(x)", {
ignore: "**/*.test.*",
nodir: true,
absolute: true,
cwd: sourceDir,
});
return {
plugins: [
dts({
exclude: ["tests/*"],
tsconfigPath: fileURLToPath(new URL("./tsconfig.json", import.meta.url)),
}),
],
build: {
lib: {
entry: inputs,
formats: ["es", "cjs"],
},
emptyOutDir: true,
minify: false,
sourcemap: true,
rollupOptions: {
external: Object.keys({
...pkg["dependencies"],
...pkg["peerDependencies"],
}),
},
},
test: {
coverage: {
enabled: true,
},
uiBase: "/",
setupFiles: "tests/setup.ts",
},
} satisfies UserConfig;
});