vue配置——>vue.config.js

vue-cli3之后都要写在新建的vue.config.js文件夹中,一般配置如下:

devServer: {
    host: '0.0.0.0',
    port: 8002,
    https: false, // https: {type: boolean}
    open: true, //设置true为打开默认浏览器,也可以指定
    proxy: {
      'admin': {
        target: 'http://192.168.1.171:10182',
        ws: true, //设置websocket
        changeOrigin: true, // 设置跨域
  pathRewrite: { //设置忽略前缀
     '^/admin': ''
        }
      }
    }
  },
  publicPath: './', // vue-cli3.3+版本使用

猜你喜欢

转载自www.cnblogs.com/yuanyuanya/p/12112213.html