Transpile & Execute Node Scripts In One Step

Here’s a quick bash script to transpile and execute your Javascripts in one step.

Create a new file called “trans” or whatever you want to call it:

babel $1.js --out-file $1.babel; node $1.babel

This script first transpiles our Javascript code with Babel, then executes it with Node.

Then make our bash script executable:

chmod +x trans

If the current directory is not in the path, you can launch it like this for devServer.js, for example.

./trans devServer


PJ Brunet

Content, CSS & Javascript © 2014-2017
by PJ Brunet.