主要是ws: false

//vue.config.js
const { defineConfig } = require('@vue/cli-service')

const port = process.env.port || '8088'
const target = process.env.VUE_APP_SERVER_URL
console.error('-----------')
console.log(target)

module.exports = defineConfig({
    transpileDependencies: true,
    lintOnSave: false,
    outputDir: process.env.outputDir,
    devServer: {
        // host: '0.0.0.0',
        host: 'localhost',
        open: true,
        port: port,
        // 代理
        proxy: {
            '/': {
                target: target,
                changeOrigin: true,
                pathRewrite: {
                    '^/': '/'
                },
                ws: false
            }
        }
    }
})
Logo

前往低代码交流专区

更多推荐