broccoli-es6-module-transpiler

raw JSON →
0.5.0 verified Fri May 01 auth: no javascript deprecated

A Broccoli plugin (v0.5.0) that transpiles ES6 modules to CommonJS, AMD, or bundle formats using Square's es6-module-transpiler. Suitable for Ember-CLI or any Broccoli-based build pipeline. Last release in 2015; deprecated in favor of Babel-based alternatives. Key differentiator: built-in bundle formatter for single-file browser output without a module loader, plus pluggable formatters for AMD/CommonJS.

error Error: Cannot find module 'es6-module-transpiler'
cause Missing peer dependency es6-module-transpiler.
fix
Run npm install es6-module-transpiler@^3.0.
error TypeError: compileModules is not a function
cause Using ES6 import syntax on a CommonJS-only package.
fix
Use require instead: var compileModules = require('broccoli-es6-module-transpiler');
error Error: formatter "amd" is not a built-in formatter
cause AMD formatter is not built-in; must provide external instance.
fix
Use: var AMDFormatter = require('es6-module-transpiler-amd-formatter'); new AMDFormatter()
deprecated This package is no longer maintained; use Babel or an up-to-date module bundler.
fix Replace with broccoli-babel-transpiler or rollup/Webpack setup.
breaking Version 0.5.0 requires the recast-based rewrite of es6-module-transpiler (>=3.x). Older transpiler (0.4.x) is incompatible.
fix Pin to es6-module-transpiler >=3.x or use the transpiler-0.4 branch for v0.4.x.
breaking Default formatter changed to 'bundle' in v0.2.0 instead of producing separate files.
fix Specify formatter: 'commonjs' if you need per-file output.
gotcha The 'output' option is required when using the bundle formatter; must be a file path.
fix Always set output: 'somefile.js' when formatter is 'bundle'.
gotcha AMD support requires an external formatter package; not built-in.
fix Install es6-module-transpiler-amd-formatter and pass instance as formatter.
npm install broccoli-es6-module-transpiler
yarn add broccoli-es6-module-transpiler
pnpm add broccoli-es6-module-transpiler

Transpiles ES6 modules from a Broccoli tree to CommonJS format using the plugin.

var compileModules = require('broccoli-es6-module-transpiler');
var lib = 'lib'; // tree with ES6 modules
var transpiled = compileModules(lib, {
  formatter: 'commonjs'
});
module.exports = transpiled;