我已经安装了react-app-rewired。在package.json中,我设置了
"scripts": {
"start": "react-app-rewired start --scripts-version react-scripts",
}当我跑的时候
npm start它会在localhost:3000上打开一个浏览器窗口。我想将其打开到我在hosts文件中设置的特定URL:port。这将允许我的本地前端应用程序联系远程API,而不会抛出CORS问题。
发布于 2021-09-30 13:06:18
这是与webpack-开发-服务器相关的
module.exports = {
//...
devServer: {
open: ['/my-page'],
},
};https://webpack.js.org/configuration/dev-server/#devserveropen
// config-overrides.js
module.exports = () => ({
devServer: (c) => {
return () => ({open: ['/newer-url']});
}
});https://stackoverflow.com/questions/64179178
复制相似问题