0

In recent react app I install nodemon globally and modified package.json to add dev command like this:

"scripts": {
    "start": "react-scripts start",
    "dev": "nodemon ./app.js",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

I start the app like this npm run dev but problem in any changes the development server start again opening new tab. How I make only current tab refreshed ?

zac
  • 4,495
  • 15
  • 62
  • 127
  • duplicate of https://stackoverflow.com/questions/51465195/configure-nodemon-to-refresh-same-tab – nlta Oct 14 '21 at 00:35
  • Does this answer your question? [Configure nodemon to refresh same tab](https://stackoverflow.com/questions/51465195/configure-nodemon-to-refresh-same-tab) – nlta Oct 14 '21 at 00:35

1 Answers1

2

Why not simply use npm start?

react-scripts start sets up the development environment and starts a server, as well as hot module reloading. Read more here.

Rukshan Jayasekara
  • 1,945
  • 1
  • 6
  • 26
  • Problem that data inside the console does not get updated unless I refreshed manually and sometimes it refresh automatically, is that normal ? – zac Oct 14 '21 at 01:08
  • 1
    @zac To my knowledge that doesn't happen often. Maybe a problem with fast-refresh. I found [this](https://stackoverflow.com/questions/43274925/development-server-of-create-react-app-does-not-auto-refresh) and could be useful – Rukshan Jayasekara Oct 14 '21 at 01:22