react-static 前端本地 IP 运行

与后端联调时,如果用到 IP 运行项目,只需要修改 package.json 中 start 即可,其他保持不变。

代码如下:

"scripts": {
   "start": "set PORT=3000 HOST=10.10.12.152/ && react-static start", // ⚠️:10.10.12.152 为当前 IP
},

运行项目时,直接 yarn start 即可。

posted @ 2021-04-08 11:08  Freya~  阅读(442)  评论(0)    收藏  举报