{"id":19461,"library":"ember-cli-babel-plugin-helpers","title":"ember-cli-babel-plugin-helpers","description":"Utilities for managing Babel plugins in Ember CLI apps and addons. Provides functions to check, find, and add plugins (hasPlugin, findPlugin, addPlugin) while preventing duplicate registrations. Targets can be EmberApp, Addon instances, or arrays. Handles Babel's plugin name normalization, including scoped packages and Windows path fixes. Current stable version 1.1.1, ships TypeScript types. Minimal dependencies; primarily for addon authors who need to ensure specific Babel plugins are present in a parent project without collisions.","status":"active","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/dfreeman/ember-cli-babel-plugin-helpers","tags":["javascript","typescript"],"install":[{"cmd":"npm install ember-cli-babel-plugin-helpers","lang":"bash","label":"npm"},{"cmd":"yarn add ember-cli-babel-plugin-helpers","lang":"bash","label":"yarn"},{"cmd":"pnpm add ember-cli-babel-plugin-helpers","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"CommonJS only; ESM import will fail. The package does not have a proper ESM entry, so use require() even in Node >=14.","wrong":"import { hasPlugin } from 'ember-cli-babel-plugin-helpers'","symbol":"hasPlugin","correct":"const { hasPlugin } = require('ember-cli-babel-plugin-helpers')"},{"note":"All three functions are named exports; accessing them via destructuring is standard.","wrong":"const findPlugin = require('ember-cli-babel-plugin-helpers').findPlugin","symbol":"findPlugin","correct":"const { findPlugin } = require('ember-cli-babel-plugin-helpers')"},{"note":"Same as above; only CommonJS is supported.","wrong":"import { addPlugin } from 'ember-cli-babel-plugin-helpers'","symbol":"addPlugin","correct":"const { addPlugin } = require('ember-cli-babel-plugin-helpers')"},{"note":"TypeScript users should use type imports for the PluginTarget type, which represents EmberApp | Addon | BabelPlugin[].","wrong":"","symbol":"PluginTarget","correct":"import type { PluginTarget } from 'ember-cli-babel-plugin-helpers'"}],"quickstart":{"code":"const { hasPlugin, addPlugin } = require('ember-cli-babel-plugin-helpers');\n\n// Inside an Ember addon's included hook\nmodule.exports = {\n  name: require('./package').name,\n\n  included(parent) {\n    this._super.included.apply(this, arguments);\n\n    if (!hasPlugin(parent, '@babel/plugin-proposal-class-properties')) {\n      addPlugin(parent, require.resolve('@babel/plugin-proposal-class-properties'));\n    }\n  }\n};","lang":"javascript","description":"Shows how an Ember addon uses hasPlugin and addPlugin to conditionally add a Babel plugin if not already present."},"warnings":[{"fix":"Replace import { hasPlugin } from 'ember-cli-babel-plugin-helpers' with const { hasPlugin } = require('ember-cli-babel-plugin-helpers')","message":"Package uses CommonJS (require) only; ESM import will throw a runtime error. Do not use import statements.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Upgrade to >=1.0.2 or normalize manually using the package's internal normalization (not exposed).","message":"On Windows, scoped package names (like @babel/plugin-x) were not correctly normalized before v1.0.2, causing hasPlugin to fail matching.","severity":"gotcha","affected_versions":"<1.0.2"},{"fix":"Ensure target is either the parent from included(), an array of plugins, or has a babel property with plugins array.","message":"Passing a target that is not an EmberApp, Addon, or array leads to unexpected behavior or errors (e.g., using a plain object without babel property).","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"N/A (no real breaking change documented)","message":"Rename from ember-cli-babel-plugin-helpers? Not applicable, but note that v1.0.0 introduced TypeScript types; no breaking API changes known.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Review existing plugin order; call addPlugin only if constraints can be satisfied, or catch errors.","message":"addPlugin with before/after constraints that conflict with each other or with existing plugin ordering will cause a runtime error (conflict detection is not graceful).","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Replace with const { hasPlugin } = require('ember-cli-babel-plugin-helpers') in your code.","cause":"Using ES module import syntax (import { hasPlugin } from '...') on a CommonJS-only package.","error":"TypeError: (0 , _emberCliBabelPluginHelpers.hasPlugin) is not a function"},{"fix":"Run npm install ember-cli-babel-plugin-helpers --save-dev (or yarn add --dev) in your Ember addon project.","cause":"The package is not installed or is missing from node_modules.","error":"Cannot find module 'ember-cli-babel-plugin-helpers'"},{"fix":"Pass a string (plugin name) or an array [name, options?, identifier?] as the second argument.","cause":"Passing an invalid structure (e.g., an object with name property) as pluginConfig.","error":"addPlugin expects pluginConfig to be a string or an array of up to 3 elements"},{"fix":"Use the parent from the addon's included hook, or pass an explicit array of plugin configurations.","cause":"Passing a bare object or other type as the target argument.","error":"Assertion Failed: You cannot call ember-cli-babel-plugin-helpers functions on a target that is not an EmberApp, addon, or array"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}