Skip to content

Latest commit

 

History

History
47 lines (32 loc) · 1.69 KB

babel.md

File metadata and controls

47 lines (32 loc) · 1.69 KB

Babel Extension

Task Definitions: '.babelrc'
Template Definitions: 'assert'
Batcher Defintions: None

Performs a single-file Babel compilation using the Babel CLI.

Babel Template

Template Options

  • auto-install (Boolean, default: true): Whether to automatically install @babel/core, @babel/cli and the used presets or plugins with npm if not present (using the npm extension). The global npm extension auto-install option will take precedence here if not otherwise set.
  • babel-rc (Boolean, default: false): Whether to read the .babelrc configuration in the current project (and creating it if it doesn't exist).
  • config-file (String): A custom Babel configuration file to use.
  • plugins (String[]): List of plugins to use.
  • presets (String[]): List of presets to use.
  • source-maps (Boolean, default: true): Whether to output a source map for each compiled file.

Example

chompfile.toml

version = 0.1

extensions = ['[email protected]:babel']

[[task]]
name = 'test'
target = 'lib/#.js'
dep = 'src/#.js'
template = 'babel'
[task.template-options]
presets = ['@babel/preset-typescript']

Ejection

When ejecting the template, only the Babel compilation CLI command will be ejected, without any .babelrc or auto installation tasks.

BabelRc Task

When setting babel-rc = true in the template options, the BabelRc Task will ensure the .babelrc exists, and if it does not will initialize a default .babelrc with an empty default configuration:

Roadmap

Most future work is recommended on the SWC extension as a preferable and faster alternative to the Babel extension.