vue05-引入config.js报错

// let config = require('./config/config')

module.exports={
  devServer:{ //开发服务器配置
    proxy:{//代理是从指定的target后面开始匹配的,不是任意位置;配置pathRewrite可以做替换
      '/api':{//axios访问 /api/xx ==  target + /api/xx  
        // target:'http://localhost:3000',
        // target:'https://uncle9.top',
        target:'https://uncle9.top',
        changeOrigin:true,//创建虚拟服务器 
        // ws:true,//websocket代理
      },
      '/douban':{// axios 访问 /douban == target + '/douban'
        target:'https://douban.uieee.com',
        changeOrigin:true,
        pathRewrite:{//路径替换
          '^/douban':'',// axios 访问/douban/v2/xx == target +'' + /v2
        }
      }
    }
  }
}

安装的时候只选择babel

原文地址:https://www.cnblogs.com/sansancn/p/11069451.html