So in my codebase I have a server.js file which is an express app that serves the index.html of dist folder.
I also have a build script which is a webpack script to build a react application which looks something like this
webpack --mode=development --out-dir dist
The issue is I have to do npm run build and then do node server.js each time I change something in the code to see my latest changes.
I want to enable hot reloading.
I tried to install watch package.
and include a script in package.json but that does not work unfortunately.
scripts: {
"watch":"watch 'npm run build' ./dist"
}
I know If I could create a build everytime code changes I can listen to server using nodemon, but I am unsure as to how I could achieve it.
And better way to do this ??