Use custom build output folder when using create-react-app

后端 未结 13 930
被撕碎了的回忆
被撕碎了的回忆 2020-12-04 17:24

Facebook provides a create-react-app command to build react apps. When we run npm run build, we see output in /build folder.

13条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 18:06

    Create-react-app Version 2+ answer

    For recent (> v2) versions of create-react-app (and possible older as well), add the following line to your package.json, then rebuild.

    "homepage": "./"
    

    You should now see the build/index.html will have relative links ./static/... instead of links to the server root: /static/....

提交回复
热议问题