mirror of
https://gitee.com/log4j/pig-ui.git
synced 2024-12-23 05:40:20 +08:00
31 lines
695 B
TypeScript
31 lines
695 B
TypeScript
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()
|
|
|
|
const viteConfig: UserConfig = {
|
|
root,
|
|
alias,
|
|
outDir: 'dist',
|
|
minify: 'esbuild',
|
|
port: VITE_PORT,
|
|
open: VITE_OPEN,
|
|
base: process.env.NODE_ENV === "production" ? "./" : VITE_PUBLIC_PATH,
|
|
optimizeDeps: {
|
|
include: ['element-plus/lib/locale/lang/zh-cn']
|
|
}
|
|
}
|
|
|
|
export default viteConfig
|