-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathvite.config.mts
More file actions
72 lines (71 loc) · 1.6 KB
/
vite.config.mts
File metadata and controls
72 lines (71 loc) · 1.6 KB
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
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
import { compression } from 'vite-plugin-compression2';
export default defineConfig({
plugins: [
react({
babel: {
plugins: [
['@babel/plugin-transform-react-jsx', { runtime: 'automatic' }],
['@babel/plugin-transform-runtime', { regenerator: true }],
],
babelrc: false,
configFile: false,
},
}),
compression({
algorithm: 'gzip',
exclude: [/\.(br)$/, /\.(gz)$/],
threshold: 1024,
compressionOptions: {
level: 9,
},
}),
],
build: {
lib: {
entry: 'src/main-server.tsx',
formats: ['cjs'],
fileName: () => 'index.cjs',
},
outDir: 'dist',
rollupOptions: {
external: ['react', 'react-dom'],
output: {
globals: {
react: 'React',
'react-dom': 'ReactDOM',
},
format: 'cjs',
exports: 'named',
interop: 'auto',
},
},
minify: false,
sourcemap: true,
target: 'node16',
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: './vitest.setup.ts',
include: ['src/**/__tests__/**/*.test.{ts,tsx}'],
exclude: ['node_modules', 'dist', '.idea', '.git', '.cache'],
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
headers: {
'Cache-Control': 'public, max-age=31536000, immutable',
},
},
});