-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
61 lines (54 loc) · 1.53 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
58
59
60
61
import { defineConfig, loadEnv, ConfigEnv } from 'vite'
import { join } from "path"
import { getEnv, regExps } from './config'
import { composePlugins } from './config/plugins'
function resolve( dir : string ) :string {
return join( __dirname, dir )
}
export default defineConfig( ( { command, mode } : ConfigEnv ) => {
const root: string = process.cwd()
const env = getEnv( loadEnv( mode, process.cwd() ) )
const { VITE_PORT, VITE_PROXY_DOMAIN, VITE_PROXY_DOMAIN_REAL, VITE_LEGACY } = env
const isServe = command === 'serve'
return {
root,
base : './', //
resolve: {
alias: {
'/@': resolve( 'src' )
},
extensions: ['.js', '.json', '.ts', '.vue']
},
plugins: composePlugins( isServe, VITE_LEGACY ),
server: {
host: '0.0.0.0',
port: VITE_PORT || 9527,
https: false,
open: false,
proxy: {
[VITE_PROXY_DOMAIN]: {
target: VITE_PROXY_DOMAIN_REAL,
ws: false,
changeOrigin: true,
rewrite: (path) => regExps(path, VITE_PROXY_DOMAIN)
}
}
},
define: {
// https://vue-i18n.intlify.dev/guide/advanced/optimization.html#quasar-cli
// 消除 vue-i18n 警告
__VUE_I18N_FULL_INSTALL__: true,
__VUE_I18N_LEGACY_API__: false,
__INTLIFY_PROD_DEVTOOLS__: false,
__APP_INFO__: JSON.stringify({
version: '3.0.0'
})
},
build: {
path : './',
sourcemap: false,
brotliSize: false,
chunkSizeWarningLimit: 2500
}
}
})