webpack代理解决跨域问题

时间:2022-11-04 06:15:26
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