andengxitong/vite.config.ts
qianhao.xu 31ec5b7624 init
2024-06-18 15:42:29 +08:00

32 lines
733 B
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 { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
export default defineConfig({
plugins: [vue()],
//解决“vite use `--host` to expose”
base: './',
server: {
port: 7001,
host: true,
open: true,
proxy: {
// https://cn.vitejs.dev/config/#server-proxy
'/dev-api': {
target:"http://localhost:7000",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/dev-api/, '')
}
}
},
resolve:{
//别名配置引用src路径下的东西可以通过@如import Layout from '@/layout/index.vue'
alias:[
{
find:'@',
replacement:resolve(__dirname,'src')
}
]
}
})