Friday, 29 November 2019

Anyone know of a way to profile why nodemon app restart (using webpack build/watcher) takes long sometimes?

Have an app that recompiles on any backend code change (using webpack watcher). The webpack bundling is fast, but then nodemon takes notice of the build change, and tries to restart, but it sometimes takes a while (10+ seconds). Not only that, it will also restart several times on its own during this process, without a file change, ie:[nodemon] app crashed - waiting for file changes before starting... [nodemon] restarting due to changes... [nodemon] starting node build/api.js [nodemon] restarting due to changes... [nodemon] starting node build/api.js [nodemon] restarting due to changes... [nodemon] starting node build/api.js API server listening on http://localhost:3000 Is anyone familiar with this happening, or might have advice for profiling why nodemon is taking a while, or maybe there is a better process manager or something? I've tried pm2 before, will give it another go...I'm a pretty seasoned developer, and have used node a while, but at this point, it's become a headache a lot, with stuff like this, and recently the app sometimes won't even respond to requests. Just sits there saying it's running, but backend doesn't respond (fetch requests stay pending). Restarted the app several times successfully, but didn't help. I had to restart the computer for it to get back to working. Sometimes it does this because of invalid backend code (for instance I once accidentally had new DateTime() instead of new Date()), and it couldn't detect this at all and produced no error, but the server would just hang. Considering just moving to Java or even PHP again.

Submitted November 29, 2019 at 10:36PM by rw3iss

No comments:

Post a Comment