2020-12-21 00:14:57 +08:00
|
|
|
import type { UserConfig } from 'vite'
|
|
|
|
import { resolve } from 'path'
|
|
|
|
import { loadEnv } from './build/utils'
|
|
|
|
|
|
|
|
const pathResolve = (dir: string): any => {
|
|
|
|
return resolve(__dirname, '.', dir)
|
|
|
|
}
|
|
|
|
|
|
|
|
const alias: Record<string, string> = {
|
|
|
|
'/@/': pathResolve('src'),
|
|
|
|
}
|
|
|
|
|
|
|
|
const { VITE_PORT, VITE_PUBLIC_PATH, VITE_OPEN } = loadEnv()
|
|
|
|
|
|
|
|
const root: string = process.cwd()
|
2020-12-09 08:55:57 +08:00
|
|
|
|
|
|
|
const viteConfig: UserConfig = {
|
2020-12-21 00:14:57 +08:00
|
|
|
root,
|
|
|
|
alias,
|
|
|
|
outDir: 'dist',
|
|
|
|
minify: 'esbuild',
|
|
|
|
port: VITE_PORT,
|
|
|
|
open: VITE_OPEN,
|
|
|
|
base: process.env.NODE_ENV === "production" ? "./" : VITE_PUBLIC_PATH,
|
2021-01-02 23:50:10 +08:00
|
|
|
optimizeDeps: {
|
|
|
|
include: ['element-plus/lib/locale/lang/zh-cn']
|
|
|
|
}
|
2020-12-09 08:55:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export default viteConfig
|