I have installed traceur using npm and have managed to compile a simple ES6 script. My problem is that the code that is generated is specific to node.js
I know that traceur can be run from the browser but I wanted to optimise further. Is There a way to run traceur from the command line (node) in similar way to how lesscss works?
I might be a bit late to the party, and you already found the solution as mentioned in your comment, but still I want to give an answer to make it easier for others to find the solution.
It's possible to compile your ES6 code with adding --script
to your command.
Compile a single file
$ traceur es6-code.js --script es5-code.js
Compile multiple files to a single file
$ traceur --out es6-code-1.js es6-code-2.js es6-code-3.js --script es5-code.min.js
Read more in Compiling Offline and Options for Compiling in the Traceur wiki.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With