-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.ts
85 lines (83 loc) · 2.13 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/// <reference types="vitest" />
import { resolve } from "path";
import react from "@vitejs/plugin-react";
import { defineConfig, loadEnv } from "vite";
import dts from "vite-plugin-dts";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import tsconfigPaths from "vite-tsconfig-paths";
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
return {
build: {
copyPublicDir: false,
lib: {
entry: resolve(__dirname, "src/index.ts"),
name: "rebac-admin",
fileName: "rebac-admin",
},
rollupOptions: {
external: ["react", "react-dom", "react-router"],
output: {
assetFileNames: "rebac-admin.[ext]",
globals: {
react: "React",
"react-dom": "ReactDOM",
"react-router": "reactRouter",
},
},
},
sourcemap: true,
},
css: {
preprocessorOptions: {
scss: {
quietDeps: true,
silenceDeprecations: ["import", "global-builtin", "mixed-decls"],
},
},
},
plugins: [
react(),
tsconfigPaths(),
dts({
rollupTypes: true,
include: ["src"],
exclude: ["**/*.msw.ts", "src/test"],
}),
nodePolyfills({
globals: {
// Required by async-limiter.
process: true,
},
}),
],
publicDir: "demo/public",
server: {
host: "0.0.0.0",
port: Number(env.PORT),
proxy: {
[env.VITE_DEMO_API_URL ?? "/api"]: {
target: env.VITE_DEMO_PROXY_API_URL ?? "/",
},
},
},
test: {
coverage: {
exclude: ["src/api/**", "src/test/**", "src/**/*.?(test-)d.ts"],
include: ["src/**/*.[jt]s?(x)"],
reporter: ["text", "json-summary", "json", "cobertura"],
reportOnFailure: true,
thresholds: {
lines: 95,
},
},
environment: "happy-dom",
globals: true,
include: [
"src/**/*.{test,spec}.?(c|m)[jt]s?(x)",
"demo/**/*.{test,spec}.?(c|m)[jt]s?(x)",
],
setupFiles: "src/test/setup.ts",
},
};
});