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.

46 lines
1.1 KiB

import { defineConfig,loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import { VantResolver } from 'unplugin-vue-components/resolvers'
// https://vitejs.dev/config/
/**
* @type {import('vite').UserConfig}
*/
export default defineConfig(({mode})=>{
const {VITE_API_URL, VITE_DOMAIN_URL, VITE_IMG_API_URL, VITE_IMG_DOMAIN_URL} = loadEnv(mode, process.cwd())
return {
plugins: [
vue(),
Components({
resolvers: [VantResolver()]
})
],
server:{
host: true,
proxy: {
[VITE_API_URL]: {
target: VITE_DOMAIN_URL,
changeOrigin: true,
ws: true,
rewrite: path=> path.replace(new RegExp(`^${VITE_API_URL}`), ''),
},
[VITE_IMG_API_URL]: {
target: VITE_IMG_DOMAIN_URL,
changeOrigin: true,
ws: true,
rewrite: path=> path.replace(new RegExp(`^${VITE_IMG_API_URL}`), ''),
}
}
},
build: {
rollupOptions: {
external: [
"element-plus",
],
},
}
}
})