Skip to content

Building custom Traceur runtimes

Erik Arvidsson edited this page Feb 6, 2015 · 8 revisions

The default runtime for Traceur, bin/traceur-runtime.js, adds functions to avoid code-bloat in generated code as well as support for module loading and polyfills for new ES6 features. Some users are very sensitive to runtime size and they also do not use all of the ES6 features. These users can create runtimes that are smaller than the default runtime.

The build rule for creating bin/traceur-runtime.js depends on RUNTIME_SRC and POLYFILL_SRC. These lists the runtime files needed for each feature. The name of the file for the runtime feature should match the Traceur option. The name of the polyfill matches the name of the global binding it polyfills/implements.

To create your own duplicate the build rule. Changing the existing build rule or variables might lead to compilation errors since Traceur itself depends on these features to compile your source.

Note that the runtime you create can fail with any Traceur update. It would be prudent to have a test procedure you can use to verify your custom runtime with each Traceur update.