-
Notifications
You must be signed in to change notification settings - Fork 25
/
vite.config.ts
59 lines (58 loc) · 1.47 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
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
import tsconfigPaths from "vite-tsconfig-paths";
import { createHtmlPlugin } from "vite-plugin-html";
import { nodePolyfills } from "vite-plugin-node-polyfills";
/// <reference types="vitest" />
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
return {
build: {
outDir: "build",
},
plugins: [
react(),
tsconfigPaths(),
createHtmlPlugin({
inject: {
data: {
injectScript:
process.env.NODE_ENV === "development"
? '<script src="/config.local.js"></script>'
: "",
},
},
}),
nodePolyfills({
// Whether to polyfill specific globals.
globals: {
// Required by bakeryjs and async-limiter.
process: true,
},
}),
],
server: {
host: "0.0.0.0",
port: Number(env.PORT),
proxy: {
"/auth": {
target: env.VITE_JIMM_API_URL ?? "/",
},
},
},
test: {
coverage: {
reporter: ["text", "json-summary", "json", "cobertura"],
reportOnFailure: true,
},
environment: "happy-dom",
globals: true,
include: [
"src/**/*.{test,spec}.?(c|m)[jt]s?(x)",
"demo/**/*.{test,spec}.?(c|m)[jt]s?(x)",
],
mockReset: true,
setupFiles: "src/testing/setup.ts",
},
};
});