使用 webpack-dev-server 跨域请求远程数据,出现下面问题:

我的 webpack.config.js 里面是这么设置的:
devServer: {
historyApiFallback: true,
noInfo: true,
hot: true,
inline: true,
proxy: {
'/api': {
target: 'https://api.server.com',
secure: false
}
}
},请求接口:
api('/api/list').then( data => {
console.log(data);
})请教一下哪里出问题了?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
是不是路径没匹配对
proxy: { '/api/*': { target: 'https://api.server.com', secure: false } }