-
Notifications
You must be signed in to change notification settings - Fork 15
/
vite.config.ts
56 lines (54 loc) · 1.28 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
import vue from '@vitejs/plugin-vue'
import path from 'path'
import { defineConfig, loadEnv } from 'vite'
import prismjs from 'vite-plugin-prismjs'
import autoImport from './core/auto-import'
import mock from './core/mock'
import { parseEnv } from './core/util'
export default defineConfig(({ command, mode }) => {
const isBuild = command == 'build'
const env = parseEnv(loadEnv(mode, process.cwd()))
return {
plugins: [
...autoImport,
vue(),
mock(isBuild, env),
prismjs({
languages: 'all',
}),
],
base: isBuild ? '/' : '/',
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
'#': path.resolve(__dirname, 'types'),
},
},
build: {
emptyOutDir: true,
rollupOptions: {
output: {
manualChunks(id: string) {
if (id.includes('node_modules')) {
return id.split('/node_modules/').pop()?.split('/')[0]
}
},
},
},
},
server: {
host: true,
port: 4178,
proxy: {
// '/': {
// target: env.VITE_API_URL,
// changeOrigin: true,
// },
// '/captcha': {
// target: env.VITE_API_URL,
// changeOrigin: true,
// },
},
},
}
})