vue.config.js

module.exports = {
  pages: {
    index: {
      //入口
      entry: 'src/main.js',
    },
  },
    lintOnSave:false, //关闭语法检查
    //开启代理服务器(方式一)
    /* devServer: {
    proxy: 'http://localhost:5000'
      }, */
    //开启代理服务器(方式二)
    devServer: {
    proxy: {
      '/api': {
        target: 'http://localhost:5000',
                pathRewrite:{'^/api':''},
        // ws: true, //用于支持websocket
        // changeOrigin: true //用于控制请求头中的host值
      },
      '/demo': {
        target: 'http://localhost:5001',
                pathRewrite:{'^/demo':''},
        // ws: true, //用于支持websocket
        // changeOrigin: true //用于控制请求头中的host值
      }
    }
  }
}
本文来自投稿,不代表本站立场,如若转载,请注明出处:https://blog.itliujia.cn/info/20220599.html
vue解决跨域问题
« 上一篇 04-29
vue项目运行自动打开浏览器配置👨‍💻
下一篇 » 05-10