-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathvite.config.ts
47 lines (46 loc) · 1.24 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
/// <reference types="vitest" />
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react-swc';
import viteTsconfigPaths from 'vite-tsconfig-paths';
import ImportMetaEnvPlugin from '@import-meta-env/unplugin';
import checker from 'vite-plugin-checker';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
return {
plugins: [
react(),
viteTsconfigPaths(),
ImportMetaEnvPlugin.vite({
example: '.env.example',
}),
checker({
typescript: {
buildMode: true,
},
eslint: {
lintCommand: 'eslint --ext .ts,.tsx,.js,.jsx src --max-warnings 0',
},
overlay: env.OSRD_VITE_OVERLAY !== 'false' && {
initialIsOpen: env.OSRD_VITE_OVERLAY_OPEN_BY_DEFAULT === 'true',
},
}),
],
build: {
outDir: 'build',
},
server: {
open: false,
port: +env.OSRD_VITE_PORT || 3000,
},
test: {
globals: true,
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
environment: 'happy-dom',
coverage: {
all: true,
reportsDirectory: './tests/unit/coverage',
},
},
};
});