我正在使用带有快速后端的create-react-app . 我有后端在端口3001上运行,并且前端在开发模式下运行通过端口3000 . 我的package.json中有 "proxy": "http://localhost:3001" ,api完美无缺 .
"proxy": "http://localhost:3001"
然而,当我使用纱线构建,然后运行 serve -s build 时,api调用根本就没有 . 我在 生产环境 中工作,当它在开发中工作时 .
serve -s build
任何帮助将非常感激 .
代理功能不适用于 生产环境 .
这可能有助于进一步解释:https://github.com/facebookincubator/create-react-app/issues/1087#issuecomment-262611096
1 回答
代理功能不适用于 生产环境 .
这可能有助于进一步解释:https://github.com/facebookincubator/create-react-app/issues/1087#issuecomment-262611096