Unfortunately this is something you will have to do yourself. You can use a tool like npm-watch to accomplish what you want though:
Install npm-watch
npm i --save-dev npm-watch
package.json
{
"name": "react-app",
"version": "0.1.0",
"private": false,
"devDependencies": {
"npm-watch": "^0.1.8",
"react-scripts": "0.9.5",
},
"dependencies": {
"react": "^15.4.2",
"react-dom": "^15.4.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"watch": "npm-watch"
},
"watch": {
"build": "src/"
}
}
Afterwards, just use npm run watch
to start up npm-watch so it can rebuild your assets on changes.
Update:
React-scripts now includes a proxy
option that proxies requests to a different host/port. For example, if your backend is running on localhost
at port 9000
under the /api
route, then you would add this line to your package.json: "proxy": "localhost:9000/api"
. You could then make requests as you normally would in production. (source: https://create-react-app.dev/docs/proxying-api-requests-in-development)