1. 程式人生 > >webpack代理解決跨域問題

webpack代理解決跨域問題

全部 lba local pub origin 跨域 public cal server

new WebpackDevServer(webpack(config), {
hot:hot,
inline: true,
compress: true,
//去掉真實ip的檢測
disableHostCheck: true,
stats: {
chunks: false,
children: false,
colors: true
},
historyApiFallback: true,
proxy: {
‘/api/**/*‘: {//接口開頭關鍵字 *表示全部
target: ‘http://ip地址‘,
//host: localPublicPath,

changeOrigin: true,
secure: false
}
}
})

就okle


webpack代理解決跨域問題