-
Notifications
You must be signed in to change notification settings - Fork 5
/
vite.config.mts
67 lines (65 loc) · 1.74 KB
/
vite.config.mts
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
/// <reference types="vitest" />
import react from '@vitejs/plugin-react';
import { defineConfig, loadEnv } from 'vite';
import mkcert from 'vite-plugin-mkcert';
import tsconfigPaths from 'vite-tsconfig-paths';
import { configDefaults } from 'vitest/config';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
// Load env file based on `mode` in the current working directory.
// Set the third parameter to '' to load all env regardless of the `VITE_` prefix.
const env = loadEnv(mode, process.cwd(), '');
return {
build: {
outDir: 'build',
rollupOptions: {
output: {
entryFileNames: `[name].js`,
chunkFileNames: 'js/[name]-[hash].js',
assetFileNames: 'assets/[name]-[hash][extname]'
}
}
},
define: {
__APP_ENV__: JSON.stringify(env.APP_ENV)
},
optimizeDeps: {
include: ['./src/**/*.{js,jsx,ts,tsx}']
},
plugins: [react(), tsconfigPaths(), mkcert()],
resolve: {
extensions: ['.tsx', '.ts', '.js', '.jsx', '.json', '.mjs', '.mts']
},
server: {
host: '0.0.0.0',
port: 3000,
strictPort: true,
hmr: {
overlay: false,
path: '/ws',
protocol: 'wss'
}
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./src/tests/setupTests.ts'],
exclude: [...configDefaults.exclude],
testTimeout: 30000,
clearMocks: true,
coverage: {
all: true,
include: ['src/**/*.tsx'],
provider: 'v8',
reporter: ['cobertura', 'clover', 'lcov'],
reportsDirectory: './coverage'
},
poolOptions: {
threads: {
maxThreads: 6,
minThreads: 3
}
}
}
};
});