webpack-dev-server配置

webpack.config.js中修改 

 devServer: {
    historyApiFallback: true,
    noInfo: true,
    inline: true,
    stats: { colors: true },
    proxy: {
        '/api': {
          target: 'http://192.168.1.130:8080/',
          pathRewrite: {'^/api' : ''},
          changeOrigin: true,
          secure: false,
        }
      }
  },

 

js调用:

.Ajax("/login",{ },
    function(data){
               consol.log(data) 
            })
原文地址:https://www.cnblogs.com/lin-dong/p/6739481.html