2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 04:22:33 +08:00
Files
panel/web/vite.config.ts

41 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { ConfigEnv } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import { convertEnv, getRootPath, getSrcPath } from './build/utils'
import { createViteProxy, viteDefine } from './build/config'
import { setupVitePlugins } from './build/plugins'
export default defineConfig((configEnv: ConfigEnv) => {
const srcPath = getSrcPath()
const rootPath = getRootPath()
const viteEnv = convertEnv(loadEnv(configEnv.mode, process.cwd()))
const { VITE_PORT, VITE_PUBLIC_PATH, VITE_USE_PROXY, VITE_PROXY_TYPE } = viteEnv
return {
base: VITE_PUBLIC_PATH,
resolve: {
alias: {
'~': rootPath,
'@': srcPath
}
},
define: viteDefine,
plugins: setupVitePlugins(viteEnv),
server: {
host: '0.0.0.0',
port: VITE_PORT,
open: false,
proxy: createViteProxy(VITE_USE_PROXY, VITE_PROXY_TYPE as ProxyType)
},
build: {
reportCompressedSize: false,
sourcemap: false,
chunkSizeWarningLimit: 1024, // chunk 大小警告的限制单位kb
commonjsOptions: {
ignoreTryCatch: false
}
}
}
})