You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.2 KiB
56 lines
1.2 KiB
import path from 'node:path' |
|
import process from 'node:process' |
|
import { loadEnv } from 'vite' |
|
import type { ConfigEnv, UserConfig } from 'vite' |
|
import viewport from 'postcss-mobile-forever' |
|
import autoprefixer from 'autoprefixer' |
|
import { createVitePlugins } from './build/vite' |
|
|
|
export default ({ mode }: ConfigEnv): UserConfig => { |
|
const root = process.cwd() |
|
const env = loadEnv(mode, root) |
|
|
|
return { |
|
base: env.VITE_APP_PUBLIC_PATH, |
|
plugins: createVitePlugins(), |
|
|
|
server: { |
|
host: true, |
|
port: 3000, |
|
proxy: { |
|
'/api': { |
|
// 接口请求地址 |
|
target: 'https://jihui.huiyipro.com/api', |
|
changeOrigin: true, |
|
rewrite: path => path.replace(/^\/api/, ''), |
|
}, |
|
}, |
|
}, |
|
|
|
resolve: { |
|
alias: { |
|
'~@': path.join(__dirname, './src'), |
|
'@': path.join(__dirname, './src'), |
|
'~': path.join(__dirname, './src/assets'), |
|
}, |
|
}, |
|
|
|
css: { |
|
postcss: { |
|
plugins: [ |
|
autoprefixer(), |
|
viewport({ |
|
appSelector: '#app', |
|
viewportWidth: 375, |
|
maxDisplayWidth: 600, |
|
}), |
|
], |
|
}, |
|
}, |
|
|
|
build: { |
|
cssCodeSplit: false, |
|
chunkSizeWarningLimit: 2048, |
|
}, |
|
} |
|
}
|
|
|