pig-ui/vue-admin-wonderful-next/vite.config.ts

31 lines
695 B
TypeScript
Raw Normal View History

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