-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
49 lines (47 loc) · 1.1 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, loadEnv} from 'vite'
import { resolve } from 'path'
import vue from '@vitejs/plugin-vue'
import { prismjsPlugin } from 'vite-plugin-prismjs'
// https://vite.dev/config/
export default () => {
const env = loadEnv("default", process.cwd());
const host = Number.parseInt(env.VITE_SERVER_PORT);
const port = env.VITE_SERVER_HOST;
return defineConfig({
plugins: [
vue(),
prismjsPlugin({
languages: 'all',
plugins: ['line-numbers','show-language','copy-to-clipboard','inline-color'],
css: true,
})
],
resolve: {
alias: {
'@': resolve(__dirname, 'src')
},
},
server: {
port: host,
host: port,
proxy: {
'/api': {
target: env.VITE_API_URL,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
},
},
preview: {
port: host,
host: port,
proxy: {
'/api': {
target: env.VITE_API_URL,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
},
}
})
}