-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
38 lines (36 loc) · 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
import type { UserConfig, ConfigEnv } from 'vite'
import { loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import { modifyVars } from './build/config/lessModifyVars'
import { wrapperEnv } from './build/utils'
import { resolve } from 'path'
function pathResolve(dir: string) {
console.log(resolve(__dirname, '.', dir))
return resolve(__dirname, '.', dir)
}
const root: string = process.cwd()
export default ({ command, mode }: ConfigEnv): UserConfig => {
console.log({ command, mode })
console.log(loadEnv(mode, root))
return {
alias: {
'/@/': `${pathResolve('src')}/`
},
css: {
preprocessorOptions: {
less: {
modifyVars: {
// reference: Avoid repeated references
hack: `true; @import (reference) "${resolve('src/design/config.less')}";`,
...modifyVars
},
javascriptEnabled: true
}
}
},
plugins: [vue()],
optimizeDeps: {
include: ['moment/dist/locale/zh-cn']
}
}
}