{"id":19001,"library":"babel-helpers","title":"babel-helpers","description":"A collection of helper functions used by Babel transforms, such as `typeof`, `extends`, `inherits`, and others. Current stable version is v7.x (e.g., v7.29.2), with v8.0.0-rc.3 as the next major pre-release. The package is part of the Babel monorepo and is released on the same cadence as Babel core (typically monthly or as needed). Key differentiator: it provides the internal helper functions that Babel plugins use to generate runtime code, and it is not intended for direct use by most developers; instead, the helpers are bundled into output via `@babel/plugin-transform-runtime` or `@babel/preset-env`.","status":"active","version":"6.24.1","language":"javascript","source_language":"en","source_url":"https://github.com/babel/babel/tree/master/packages/babel-helpers","tags":["javascript"],"install":[{"cmd":"npm install babel-helpers","lang":"bash","label":"npm"},{"cmd":"yarn add babel-helpers","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-helpers","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used in examples and internally for AST node creation","package":"babel-types","optional":true}],"imports":[{"note":"Default export is not available. Use named import for the 'get' function.","wrong":"import helpers from 'babel-helpers'","symbol":"get","correct":"import { get } from 'babel-helpers'"},{"note":"Note that list() returns an array of all helper names. In CJS, require is fine.","wrong":"const list = require('babel-helpers').list","symbol":"list","correct":"import { list } from 'babel-helpers'"},{"note":"In ESM, use namespace import to access both 'get' and 'list' as properties.","wrong":"const helpers = require('babel-helpers')","symbol":"all","correct":"import * as helpers from 'babel-helpers'"}],"quickstart":{"code":"import { get } from 'babel-helpers';\nimport * as t from 'babel-types';\n\nconst typeofHelper = get('typeof');\nconsole.log(t.isExpressionStatement(typeofHelper)); // true","lang":"typescript","description":"Demonstrates importing and using the 'get' function to retrieve a helper by name, and checking its AST type with babel-types."},"warnings":[{"fix":"Update to latest v7.x or v8.x and prefer using plugins that handle helpers automatically.","message":"babel-helpers v6 and v7 have breaking changes in helper APIs. Direct use of helpers package is discouraged; use @babel/plugin-transform-runtime or @babel/preset-env instead.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Stay updated with Babel releases and use the specific plugin that provides the helper.","message":"Some helpers may be deprecated in future versions. Always check the changelog for deprecations.","severity":"deprecated","affected_versions":">=7.0.0"},{"fix":"Use a bundler like webpack or rollup with babel-loader to include helpers.","message":"Importing from 'babel-helpers' does not work in browser environments without a bundler. The package is designed for Node.js and requires transformation.","severity":"gotcha","affected_versions":"*"},{"fix":"Validate helper names using the 'list' function or refer to the Babel source code.","message":"The 'get' function expects a string name and returns an AST node. If the name is invalid, it may throw or return undefined.","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":"Run npm install --save-dev babel-helpers","cause":"Package is not installed or not in node_modules.","error":"Cannot find module 'babel-helpers'"},{"fix":"Use import { get } from 'babel-helpers' instead of import helpers from 'babel-helpers'","cause":"Importing the default export instead of the named export.","error":"TypeError: helpers.get is not a function"},{"fix":"Use helpers.list() to get all available helper names.","cause":"Requested helper name does not exist.","error":"Error: Unknown helper: myHelper"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}