javascripttraceurangular

Traceur.js vs Traceur-runtime.js


When I cloned and build traceur I got 2 files installed: traceur.js and traceur-runtime.js.

The traceur docs(specifically) here won't really explain the difference between the traceur.js and traceur-runtime.js.

I know that traceur.js contains the content of traceur-runtime.js and the traceur-runtime.js is a small part of traceur.js.

I understand traceur.js can be used by NodeJS, traceur.js + bootstrap.js(just for initiation) used for the browser use, traceur-runtime.js is used by Angular2.

My questions:


Solution

  • I'm not 100% sure on this, but traceur-runtime is just the polyfills that your browser needs to use es6 features while traceur is the full node tool for compiling es6 to es5.

    Angular2 uses TypeScript to compile to es5, but you still need to polyfill in modular loading ie. System.import('') so you can load only what your app needs. Otherwise angular needs to be bound to the window along with all of the Angular2 code.