External helpers

How to use the external helpers.

Details

babel has a few helper functions that'll be placed at the top of the generated code if needed so it's not inlined multiple times throughout that file. This may become an issue if you have multiple files, especially when you're sending them to the browser. gzip alleviates most of this concern but it's still not ideal.

You can tell babel to not place any declarations at the top of your files and instead just point them to a reference contained within the external helpers.

Usage

$ babel --external-helpers
babel.transform("code", { externalHelpers: true });

Getting the external helpers

$ babel-external-helpers

or

require("babel").buildExternalHelpers();

or from an npm release in external-helpers.js from the babel directory.