-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
57 lines (54 loc) · 1.53 KB
/
vite.config.ts
File metadata and controls
57 lines (54 loc) · 1.53 KB
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
49
50
51
52
53
54
55
56
57
/// <reference types="vitest" />
import { resolve } from "path";
import react from "@vitejs/plugin-react-swc";
import UnoCSS from "unocss/vite";
import { defineConfig } from "vite";
import { configDefaults, coverageConfigDefaults } from "vitest/config";
const isSite = !!process.env.SITE;
export default defineConfig((config) => ({
plugins: [react(), UnoCSS()],
build: {
// skip minification to make tests faster
minify: config.mode !== "test" ? "esbuild" : false,
...(isSite
? { outDir: "site" }
: {
lib: {
entry: resolve(__dirname, "lib/index.ts"),
name: "cheshirecode-pkce-wrapper",
// the proper extensions will be added
fileName: "lib",
},
rollupOptions: {
external: ["react", "unocss"],
output: {
globals: {
react: "react",
},
},
},
}),
},
test: {
globals: true,
setupFiles: ["src/services/test/setup.ts"],
include: ["**/*(*.)?{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
exclude: [...configDefaults.exclude, "site/**/*"],
coverage: {
exclude: [...coverageConfigDefaults.exclude, "site/**/*"],
reporter: [
["lcov", { projectRoot: "./src" }],
["json", { file: "coverage.json" }],
["text"],
["html", { subdir: "./html" }],
],
provider: "v8",
},
},
resolve: {
alias: {
"~": resolve(__dirname, "./"),
"@": resolve(__dirname, "./src"),
},
},
}));