-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
57 lines (51 loc) · 1.46 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
import { defineConfig } from 'vite'
import type { WatcherOptions } from 'rollup'
import solidPlugin from 'vite-plugin-solid'
import tsconfigPaths from 'vite-tsconfig-paths'
const CONFING = {
al: ['http://127.0.0.1:7700', 'app', 8700],
sl: ['http://127.0.0.1:7700', 'simple', 8707],
} as const
let target = CONFING.al
if (process.env.target && CONFING[process.env.target]) {
target = CONFING[process.env.target]
}
console.log('target: ' + target[1])
export default defineConfig(env => {
let watch: WatcherOptions | null = null
if (env.mode == 'development') {
watch = {
clearScreen: true,
}
}
return {
root: target[1],
plugins: [tsconfigPaths(), solidPlugin({ hot: false })],
server: {
port: target[2],
proxy: {
'/api/': {
target: target[0],
changeOrigin: true,
},
'/record/': {
target: target[0],
changeOrigin: true,
},
'/simurgh-record/': {
target: target[0],
changeOrigin: true,
},
},
},
build: {
target: 'esnext',
outDir: 'dist',
watch,
assetsInlineLimit: 0,
emptyOutDir: true,
copyPublicDir: false,
assetsDir: target[1] + '-assets',
},
}
})