import path from'path'
import { defineConfig } from'vite'
import vue from'@vitejs/plugin-vue'
const isProduction = process.env.NODE_ENV ==='production'
// https://vitejs.dev/config/
export default defineConfig({
//配置路徑別名
? resolve: {
alias: {
'@': path.resolve(__dirname, './src')
}
},
? base: isProduction ?'./' :'',
? server: {
????????open:true, // 如果需要在服務啟動后自動打開頁面可以打開這個設置
? ? proxy: {
'/api': {
target:'www.XXXX.com',
? ? ? ? changeOrigin:true
? ? ? }
}
},
? //vite 在 build 的時候默認會進行壓縮計算,但 vite 實際上不提供 gzip 壓縮功能,所以不需要讓他花時間算壓縮后大小,關掉這個設置可以提升打包速度。
? build: {
brotliSize:false // 默認為true
? },
? plugins: [vue()],
})