How to make create-react-app auto build?

后端 未结 5 1893
傲寒
傲寒 2020-12-14 09:21

I have been using create react app for a while. \'npm start\' or \'yarn start\' autoreloads works fine by itself but now I have an another problem. Currently I run the app o

5条回答
  •  借酒劲吻你
    2020-12-14 10:05

    i am also using create react app, this is how i modified my scripts to run project for development(windows), build the production build and run the production build.

    "scripts": {
        "start": "set PORT=8080 && react-scripts start",
        "build": "react-scripts build",
        "deploy": "set PORT=8008 && serve -s build"
      }
    

    npm start : run project for development(windows) npm run-script build : build the production build npm run-script deploy: run the production build

    • npm install -g serve before run npm run-script deploy.

提交回复
热议问题