vite-vue-ts vite.config.ts配置跨域
import type { UserConfig } from 'vite';const viteConfig:UserConfig = {port: 3555,hostname: "localhost",proxy: {'/api': {target: 'http://www.baidu.com',changeOrigin: true,ws: true,
·
import type { UserConfig } from 'vite';
const viteConfig:UserConfig = {
port: 3555,
hostname: "localhost",
proxy: {
'/api': {
target: 'http://www.baidu.com',
changeOrigin: true,
ws: true,
rewrite: path => path.replace(/^\/api/, '')
}
}
}
export default viteConfig;
更多推荐
已为社区贡献1条内容
所有评论(0)