Closed jiajianrong closed 3 years ago
It's faster because that babel-node
will restart completely and need to re-load all the babel dependencies, which takes a little while, while babel-watch
keeps the process running.
Think of it like an all-in-one combination of nodemon
with babel --watch
.
In the readme
Why should I use it?
,That means there are two node processes: main process is in charge of babel transpilation and file watching, then passes the translated(es5) code to the child process, which runs the code as web server.
When a source code file is changed, you have to use babel to regenerate the es5 code, and terminate the old child process and recreate a new one as the web server. So why the performance is better than nodemon&babel-node? Thanks.
PS: nodemon&babel-node here is supposed to be:
nodemon --inspect=10111 --exec babel-node server.js