mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2026-01-20 16:53:37 +08:00
chore:更换到主分支
This commit is contained in:
52
vite.config.ts
Normal file
52
vite.config.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
import { resolve } from 'path'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import type { UserConfig } from 'vite'
|
||||
import { loadEnv } from './build/utils'
|
||||
import { createProxy } from './build/proxy'
|
||||
|
||||
const pathResolve = (dir: string): any => {
|
||||
return resolve(__dirname, '.', dir)
|
||||
}
|
||||
|
||||
const { VITE_PORT, VITE_PUBLIC_PATH, VITE_PROXY, VITE_OPEN } = loadEnv()
|
||||
|
||||
const alias: Record<string, string> = {
|
||||
'/@': pathResolve('src'),
|
||||
}
|
||||
|
||||
const root: string = process.cwd()
|
||||
|
||||
const viteConfig: UserConfig = {
|
||||
/**
|
||||
* 基本公共路径
|
||||
* @default '/'
|
||||
*/
|
||||
base: process.env.NODE_ENV === "production" ? "/manages/" : VITE_PUBLIC_PATH,
|
||||
root,
|
||||
resolve: {
|
||||
alias
|
||||
},
|
||||
// 服务端渲染
|
||||
server: {
|
||||
// 是否开启 https
|
||||
https: false,
|
||||
/**
|
||||
* 端口号
|
||||
* @default 3000
|
||||
*/
|
||||
port: VITE_PORT,
|
||||
// 本地跨域代理
|
||||
proxy: createProxy(VITE_PROXY)
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
],
|
||||
build: {
|
||||
brotliSize: false,
|
||||
// 消除打包大小超过500kb警告
|
||||
chunkSizeWarningLimit: 800
|
||||
}
|
||||
}
|
||||
|
||||
export default viteConfig
|
||||
Reference in New Issue
Block a user