Open chrisngobanh opened 8 years ago
That's a good idea and would definitely be more efficient and would reduce the startup time after the initial compile.
I don't think it would slow down development because you'd have to wait for it to finish compiling either way. In fact, it might even speed up development if you told Gulp to only recompile files that have changed. Right now all files are compiled every time you run.
I am leaning towards not doing this though because I like how right now it doesn't require gulp installed to run.
Since you have to manually restart the Node server every time you make a change anyways (Ctrl-C, Up-Arrow, Enter), an alternative would be to change the npm start
script to transpile your files before starting up the app. This way, you won't need Gulp.
However, I'm not sure if this would be any different than what you're currently doing.
It is not recommended to use babel-register if you want to write ES6 JS for Node because it's slow since Node needs to compile the files during runtime.
https://babeljs.io/docs/usage/require/
What I recommend doing is: transpile the ES6 code to ES5, then have Node run the ES5 code instead. I use personally Gulp to do this automatically whenever I make a change to the ES6 code
However, the downside to this is that it may make development a bit slower since you have to wait for the files to finish transpiling before you try it out.