-
Notifications
You must be signed in to change notification settings - Fork 3
/
vite.config.ts
49 lines (44 loc) · 1.23 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
import { defineConfig } from 'vite'
import type { WatcherOptions } from 'rollup'
import solidPlugin from 'vite-plugin-solid'
import tsconfigPaths from 'vite-tsconfig-paths'
let target = 'http://127.0.0.1:7000'
let root = 'admin'
// let target = 'https://heydari-mi.com'
// let root = 'app'
// if (process.env.local_api_target) {
// target = 'http://127.0.0.1:7000'
// }
// if (process.env.root == 'admin') root = 'admin'
// console.log(`api target: ${target}\nroot: ${root}`)
export default defineConfig(env => {
let watch: WatcherOptions | null = null
if (env.mode == 'development') {
watch = {
clearScreen: true,
}
}
return {
plugins: [tsconfigPaths(), solidPlugin({ hot: false })],
server: {
port: 8000,
proxy: {
'/api/': {
target,
changeOrigin: true,
},
'/record/': target,
'/static/': target,
},
},
root,
build: {
target: 'esnext',
outDir: 'dist',
watch,
assetsInlineLimit: 0,
copyPublicDir: false,
assetsDir: root + '-assets',
},
}
})