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

后端 未结 13 904
被撕碎了的回忆
被撕碎了的回忆 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:01

    You can update the configuration with a little hack, under your root directory:

    1. npm run eject
    2. config/webpack.config.prod.js - line 61 - change path to: __dirname + './../--your directory of choice--'
    3. config/paths.js - line 68 - update to resolveApp('./--your directory of choice--')

    replace --your directory of choice-- with the folder directory you want it to build on

    note the path I provided can be a bit dirty, but this is all you need to do to modify the configuration.

提交回复
热议问题