【VUE】webpack使用websocket

webpack

devServer: {
    proxy: {
        '/manage': {
            target: 'http://localhost:8765',
            pathRewrite: {
                '^/manage': '/manage'
            }
        },
        '/websocket': {
            target: 'ws://localhost:8763', // 后端目标接口地址
            changeOrigin: true, // 是否允许跨域
            ws: true, // 开启ws
            pathRewrite: {
                '^/websocket': '/websocket' // 重写
            }
        }
    }
}
原文地址:https://www.cnblogs.com/yangchongxing/p/13540913.html