es6-module-transpiler-js-brunch
raw JSON → 0.1.0 verified Fri May 01 auth: no javascript deprecated
Brunch plugin for Square's ES6 module transpiler, enabling ES6 module syntax (import/export) compilation to AMD or CommonJS. Version 0.1.0, last release in 2014. Not actively maintained. Key differentiator from similar plugins: no CoffeeScript dependency, enhanced configuration for module name mapping and wrapper type. Note: CommonJS support is broken; only AMD is practically useful. Requires disabling Brunch's default module wrapper.
Common errors
error Error: Cannot find module 'es6-module-transpiler' ↓
cause Missing peer dependency es6-module-transpiler.
fix
npm install --save es6-module-transpiler
error Module wrapper expected 'amd' or 'cjs', got 'xxx' ↓
cause Invalid wrapper option value.
fix
Set wrapper to 'amd' or 'cjs' in config.
Warnings
breaking CommonJS (cjs) wrapper does not produce usable code for typical interop; only AMD is supported. ↓
fix Use wrapper: 'amd' and an AMD loader like require.js or ember-loader.
deprecated Package is unmaintained since 2014; ES6 module transpiler is obsolete. ↓
fix Migrate to a modern tool like Babel or TypeScript with Brunch plugins (e.g., babel-brunch).
gotcha Brunch's built-in module wrapper must be disabled via modules.wrapper: false, otherwise class conflicts occur. ↓
fix Add modules: { wrapper: false } to brunch config.
gotcha Plugin only processes files matching the match regex (default /^app/); files outside are not transpiled. ↓
fix Adjust the match pattern to include all desired directories.
Install
npm install es6-module-transpiler-js-brunch yarn add es6-module-transpiler-js-brunch pnpm add es6-module-transpiler-js-brunch Imports
- plugin wrong
import es6ModuleTranspiler from 'es6-module-transpiler-js-brunch'correctplugins: { es6ModuleTranspiler: { ... } } in brunch config
Quickstart
// In brunch config (config.js or config.coffee)
module.exports = {
plugins: {
es6ModuleTranspiler: {
match: /^app/,
wrapper: 'amd',
moduleName: (path) => 'myapp/' + path.replace(/\.js$/, '')
}
},
modules: {
wrapper: false // Must disable brunch module wrapper
}
}