-
Notifications
You must be signed in to change notification settings - Fork 19
/
vite.config.ts
59 lines (57 loc) · 1.41 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
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import tsconfigPaths from 'vite-tsconfig-paths';
import svgr from 'vite-plugin-svgr';
import { checker } from 'vite-plugin-checker';
import { ValidateEnv } from '@julr/vite-plugin-validate-env';
import { visualizer } from 'rollup-plugin-visualizer';
import { z } from 'zod';
export default defineConfig(({ mode }) => ({
plugins: [
ValidateEnv({
validator: 'zod',
schema: {
VITE_API_URL: z.string().url().or(z.string().startsWith('/')),
},
}),
react({
plugins: [
['@swc-jotai/debug-label', {}],
['@swc-jotai/react-refresh', {}],
],
}),
tsconfigPaths(),
svgr(),
mode !== 'test' &&
checker({
enableBuild: false,
overlay: false,
typescript: true,
eslint: {
lintCommand:
'eslint "./**/*.{js,cjs,ts,tsx}" --max-warnings 0 --report-unused-disable-directives',
},
}),
process.env.VISUALIZE === 'true' &&
visualizer({
filename: 'dist/stats.html',
open: true,
template: 'sunburst',
}),
],
server: {
open: true,
port: 3000,
},
build: {
sourcemap: true,
chunkSizeWarningLimit: 1000,
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: 'src/tests/setup.ts',
mockReset: true,
},
}));