{"id":19388,"library":"broccoli-babel-transpiler","title":"broccoli-babel-transpiler","description":"A Broccoli plugin for transpiling ES6+ to readable ES5 using Babel, with caching and parallelization. Current stable version 8.0.2 supports Node 16+ and 18+ and requires @babel/core >=7.17.9 as a peer dependency. Key differentiators include persistent caching across rebuilds (via cacheKey/cacheKeyPlugin methods) and async plugin support since v8.0.1. Notable breaking changes in v8 include dropping Node 14 and moving @babel/core to peer deps. Commonly used in Ember.js and other Broccoli-based build pipelines.","status":"active","version":"8.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/babel/broccoli-babel-transpiler","tags":["javascript","broccoli-plugin","transpiler","es6","ecmascript","ecmascript6","harmony","js"],"install":[{"cmd":"npm install broccoli-babel-transpiler","lang":"bash","label":"npm"},{"cmd":"yarn add broccoli-babel-transpiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add broccoli-babel-transpiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency since v8.0.0; required for all transpilation","package":"@babel/core","optional":false},{"reason":"Base class for Broccoli plugins","package":"broccoli-plugin","optional":false},{"reason":"Used for parallelizing transpilation across workers","package":"workerpool","optional":false}],"imports":[{"note":"Package is CJS-only; default export is the plugin function. ESM import may fail or require .default.","wrong":"import babel from 'broccoli-babel-transpiler';","symbol":"default","correct":"const babel = require('broccoli-babel-transpiler');"},{"note":"Plugin authors must implement cacheKey() to enable caching. This is an informal interface, not a base class.","wrong":"","symbol":"BabelPlugin","correct":"class MyPlugin { cacheKey() { return 'myplugin-cachekey'; } }"}],"quickstart":{"code":"const babel = require('broccoli-babel-transpiler');\nconst broccoli = require('broccoli');\nconst funnel = require('broccoli-funnel');\n\n// Create a tree of JavaScript files\nconst appTree = funnel('src', { include: ['**/*.js'] });\n\n// Transpile with babel\nconst transpiled = babel(appTree, {\n  presets: [\n    ['@babel/preset-env', {\n      targets: { browsers: ['last 2 versions'] }\n    }]\n  ]\n});\n\n// Build the output\nconst builder = new broccoli.Builder(transpiled);\nbuilder.build().then(() => {\n  console.log('Build complete!');\n}).catch(err => console.error(err));","lang":"javascript","description":"Shows how to use broccoli-babel-transpiler with a Brocfile-like setup: funnel source files, transpile via babel with preset-env targeting modern browsers, then build with Broccoli."},"warnings":[{"fix":"Install @babel/core explicitly in your project: npm install --save-dev @babel/core","message":"Since v8.0.0, @babel/core is no longer bundled; it must be installed as a peer dependency.","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Upgrade to Node 16 or 18.","message":"Node 14 support dropped in v8.0.0.","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Provide a presets or plugins array in the Babel options.","message":"Empty options will not transpile anything; you must specify presets or plugins explicitly.","severity":"gotcha","affected_versions":">=6.0.0"},{"fix":"Define a cacheKey() method that returns a string uniquely representing plugin configuration.","message":"Plugin caching requires implementing cacheKey() method on the plugin; otherwise, the plugin's effect is not cached and may cause unnecessary rebuilds.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install --save-dev @babel/core","cause":"@babel/core is not installed because it moved to peerDependencies in v8.","error":"Cannot find module '@babel/core'"},{"fix":"Use require('broccoli-babel-transpiler') instead.","cause":"Using ES module import (import babel from '...') on a CJS package.","error":"TypeError: babel is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}