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,
            rewrite: path => path.replace(/^\/api/, '')
        }
    }
}

export default viteConfig;

你可能感兴趣的:(VUE)