-
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathvite.config.ts
More file actions
50 lines (46 loc) · 1.14 KB
/
vite.config.ts
File metadata and controls
50 lines (46 loc) · 1.14 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
import { execSync } from 'node:child_process';
import react from '@vitejs/plugin-react';
import { visualizer } from 'rollup-plugin-visualizer';
import { defineConfig } from 'vite';
const basePath = process.env.BASE_PATH || '/';
const commitHash = execSync('git rev-parse --short HEAD').toString();
export default defineConfig({
define: {
APP_COMMIT_HASH: JSON.stringify(commitHash),
APP_VERSION: JSON.stringify(process.env.npm_package_version),
},
plugins: [
react(),
visualizer({
filename: 'build_stats/stats_treemap.html',
open: false,
gzipSize: true,
template: 'treemap',
}),
],
base: basePath,
server: {
port: 3000,
strictPort: true, // Port 3000 is required by CORS
},
preview: {
port: 3000,
},
build: {
outDir: 'build',
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes('node_modules')) {
if (/\/(react)/.test(id)) {
return 'react-vendor';
}
if (/\/asciinema-player/.test(id)) {
return 'asciinema-vendor';
}
}
},
},
},
},
});