spaaace icon indicating copy to clipboard operation
spaaace copied to clipboard

start-dev and dev are not working

Open T-vK opened this issue 6 years ago • 1 comments

I wanted to use this project as a base for a new one, but it's really frustrating to constantly run npm run build (which takes forever) and then npm start again. I saw there are 2 run scripts start-dev and dev in the package.json, but when I run the start-dev script, it just never updates and always provides the old files. The dev script is even worse, I mean it appears as if it would do something, but on localhost:3000 there is nothing and I didn't see a reference to another port anywhere.

T-vK avatar Aug 14 '19 16:08 T-vK

You run npm run dev in one console. This sets webpack to run forever in that console, watching for file changes

then you open a 2nd console, and run npm run start-dev which will trigger nodemon to watch the entire project for file changes, and restart the server

to make nodemon not trigger for every change,but only on the "rebuilt" changes:

change the dev-start script to: nodemon --watch dist --watch dist-server dist-server/main.js

This tells nodemon to only restart the server when the packaged files change

BONUS: Add the following to the webpack.config to force webpack to wait for 2.5 seconds before rebuilding files (cuts down on builds triggering while you are making changes if you use something like autosave)

,
  watchOptions: {
    aggregateTimeout: 2500
  },

NC-Development avatar Oct 20 '19 22:10 NC-Development