Registry / web-framework / ember-cli-babel

ember-cli-babel

JSON →
library8.3.1jsnpmunverified

ember-cli-babel is the official Ember CLI addon responsible for integrating Babel into Ember applications and addons. It transpiles modern JavaScript (ESNext) down to a syntax supported by target browsers, leveraging `@babel/preset-env` and respecting the `config/targets.js` file. The current stable version is 8.3.1, with releases occurring as needed to align with Babel updates, Ember CLI changes, and bug fixes. Key differentiators include its deep integration with the Ember CLI build pipeline, automatic polyfill management (though `includePolyfill` was removed in v8), and support for advanced features like static class blocks and TypeScript transpilation. It provides a robust, zero-config-by-default setup while offering extensive customization options through the `ember-cli-build.js` file for both Babel presets/plugins and `ember-cli-babel`'s internal behavior, making it indispensable for modern Ember development.

npm install ember-cli-babel
INSTALL
IMPORT
SIG · EMBER-CLI-BABEL
E
ember-cli-babel
web-frameworkjavascriptv8.3.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

babel (configuration object)
new EmberApp(defaults, { babel: { /* preset-env and plugin options */ } })
Directly creating a .babelrc file (it is ignored by default)
This object within `ember-cli-build.js` configures Babel's core behavior, including `babel-preset-env` options and custom plugins.
ember-cli-babel (configuration object)
new EmberApp(defaults, { 'ember-cli-babel': { /* addon-specific options */ } })
Setting 'ember-cli-babel' specific options directly under the 'babel' key.
This object within `ember-cli-build.js` is used for options specific to `ember-cli-babel`'s integration, such as enabling TypeScript transform or disabling debug tooling.
Custom Babel Plugins
plugins: [require.resolve('@babel/plugin-proposal-decorators')]
plugins: ['@babel/plugin-proposal-decorators'] (without require.resolve, which might cause path resolution issues)
When adding custom Babel plugins to the `babel.plugins` array, it is recommended to use `require.resolve` to ensure the plugin's path is correctly found within the build system.

Demonstrates how to configure `ember-cli-babel` within `ember-cli-build.js`, including setting Babel options (like `loose` mode and custom plugins) and `ember-cli-babel` specific options (like enabling TypeScript transpilation or disabling debug tooling).

/* eslint-env node */ 'use strict'; const EmberApp = require('ember-cli/lib/broccoli/ember-app'); module.exports = function (defaults) { let app = new EmberApp(defaults, { // Configure Babel transpilation options babel: { // Enable "loose" mode for class properties for smaller output and compatibility. loose: true, // Exclude a specific transform if not needed or handled by other means. exclude: [ 'transform-regenerator' ], // Add custom Babel plugins, using require.resolve for robust path resolution. plugins: [ require.resolve('@babel/plugin-proposal-decorators') // Common in Ember for decorators ] }, // Configure ember-cli-babel specific options 'ember-cli-babel': { // Disable debug tooling support for production builds to optimize size. disableDebugTooling: EmberApp.env() === 'production', // Enable TypeScript transpilation if your project uses TypeScript. // Note: This handles syntax transpilation, not type checking. enableTypeScriptTransform: true, // Specify additional file extensions for Babel to process. extensions: ['js', 'ts', 'gjs', 'gts'] } // Other EmberApp configurations go here }); return app.toTree(); };
Debug
Known issues
breaking`ember-cli-babel` v8.0.0 dropped support for Node.js v14. The minimum supported Node.js version is now v16, v18, or v20+.
fix
Upgrade your Node.js environment to version 16, 18, or 20 or newer to use `ember-cli-babel` v8+.
affects: >=8.0.0
breakingThe `includePolyfill` option was removed in `ember-cli-babel` v8.0.0. Projects relying on this option for automatic polyfill inclusion will need to update their strategy.
fix
Remove the `includePolyfill` option. Manually add polyfills using a tool like `ember-auto-import` combined with `core-js` or `@babel/polyfill` for explicit polyfill management.
affects: >=8.0.0
breaking`ember-cli-babel` v8.0.0 updated its internal dependency `broccoli-babel-transpiler` to v8, which may introduce breaking changes or require adjustments to advanced configurations.
fix
Review `broccoli-babel-transpiler` v8 release notes if you encounter unexpected build issues after upgrading. Most applications should not require direct changes.
affects: >=8.0.0
gotchaBy default, `ember-cli-babel` ignores `.babelrc` files. All Babel configurations must be specified within the `babel` object in your `ember-cli-build.js` or addon's `index.js`.
fix
Migrate any existing `.babelrc` configuration into the `babel` property of your `EmberApp` options in `ember-cli-build.js`.
affects: >=7.x
gotchaWith Babel's evolution, `@babel/plugin-proposal-*` packages have largely been replaced by `@babel/plugin-transform-*` counterparts. While `ember-cli-babel` adapts, directly configured plugins might need updates.
fix
If manually specifying Babel plugins, ensure you are using the correct `@babel/plugin-transform-*` packages where applicable, especially for features like class properties, decorators, and private methods.
affects: >=8.3.0
Errors
Common errors & fixes
Error: The currently active Node.js version (v14.x) is not supported by ember-cli-babel. Please upgrade to Node.js v16, v18, or v20 or higher.
Using an unsupported Node.js version with `ember-cli-babel` v8 or newer.
fix
Upgrade your Node.js environment to a supported version (e.g., `nvm install 18` and `nvm use 18`).
Error: .babelrc files are ignored by ember-cli-babel. Please configure Babel options in ember-cli-build.js instead.
Attempting to configure Babel using a `.babelrc` file instead of `ember-cli-build.js`.
fix
Remove your `.babelrc` file and transfer all Babel configurations to the `babel` object within your `new EmberApp()` constructor in `ember-cli-build.js`.
ReferenceError: regeneratorRuntime is not defined
The `transform-regenerator` plugin was explicitly excluded from Babel, and no global polyfill for generator functions is being provided.
fix
Either remove `transform-regenerator` from the `exclude` list in your Babel configuration, or ensure that a polyfill like `core-js/stable/regenerator-runtime` is explicitly imported in your application.
Upgrade
Version history
8.3.1latest on npm
Audit
Dependencies
@babel/corerequiredPeer dependency required by Babel's ecosystem for core transpilation functionality.
Agent activity
2 hits · last 30 days
node
2
Resources
ember-cli-babel — npm install ember-cli-babel · libregistry