Vue3 报错:WebSocket connection to ‘ws://X.XXX.X.XX:8080/ws‘ failed:

Problem: There is no problem with the page, but when I open the console, a series of error messages appear as shown in the figure below.

problem solved: 

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave: false,  
  devServer:{
  host: '0.0.0.0',
  port: 8080,
  client: {
    webSocketURL: 'ws://0.0.0.0:8080/ws',
  },
  headers: {
    'Access-Control-Allow-Origin': '*',
  },
}
})

 After modification, just run it again

Guess you like

Origin blog.csdn.net/qq_52331221/article/details/130659200