-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
59 lines (57 loc) · 1.52 KB
/
vite.config.js
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
import { fileURLToPath, URL } from 'node:url'
import { defineConfig, loadEnv } from 'vite'
import { createVitePlugins } from './build/vite/plugins'
import { createProxy } from './build/vite/proxy'
import { wrapperEnv } from './build/util'
export default defineConfig(({ command, mode }) => {
const env = loadEnv(mode, process.cwd())
const viteEnv = wrapperEnv(env)
const { VITE_DROP_CONSOLE, VITE_API_CONTEXT, VITE_API_URL } = viteEnv
const isBuild = command === 'build'
return {
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "@/assets/css/theme/index.scss" as *;`
}
}
},
define: {
__APP_VERSION__: JSON.stringify('v1.0.0'),
'process.env': {}
},
plugins: createVitePlugins(viteEnv, isBuild),
server: {
// open: true,
port: 5172,
proxy: createProxy([
{
'/api-mock': VITE_API_URL + VITE_API_CONTEXT
}
])
},
esbuild: {
pure: VITE_DROP_CONSOLE ? ['console.log', 'debugger'] : []
},
// build: {
// outDir: 'dist',
// rollupOptions: {
// // 路由分块
// // https://rollupjs.org/guide/en/#outputmanualchunks
// output: {
// manualChunks: {
// // 'group-user': ['./src/pages/user/index']
// }
// }
// }
// },
optimizeDeps: {
include: ['element-plus/dist/locale/zh-cn.mjs']
}
}
})