wireguard-dashboard-admin/vite.config.js

38 lines
1020 B
JavaScript
Raw Normal View History

2022-01-08 17:20:46 +08:00
import { defineConfig, loadEnv } from 'vite'
import path from 'path'
2022-05-03 22:37:51 +08:00
import { wrapperEnv, createProxy } from './build/utils'
import { createVitePlugins } from './build/plugin'
2022-01-08 17:20:46 +08:00
import { OUTPUT_DIR } from './build/constant'
export default defineConfig(({ command, mode }) => {
const root = process.cwd()
const isBuild = command === 'build'
const env = loadEnv(mode, process.cwd())
const viteEnv = wrapperEnv(env)
const { VITE_PORT, VITE_PUBLIC_PATH, VITE_PROXY } = viteEnv
return {
root,
base: VITE_PUBLIC_PATH || '/',
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
plugins: createVitePlugins(viteEnv, isBuild),
server: {
host: '0.0.0.0',
port: VITE_PORT,
proxy: createProxy(VITE_PROXY),
},
build: {
target: 'es2015',
outDir: OUTPUT_DIR,
2022-05-19 15:40:02 +08:00
reportCompressedSize: false, // 启用/禁用 gzip 压缩大小报告
chunkSizeWarningLimit: 1024, // chunk 大小警告的限制单位kb
2022-01-08 17:20:46 +08:00
},
}
})