Registry / serialization / babel-helpers

babel-helpers

JSON →
library6.24.1jsnpmunverified

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`.

npm install babel-helpers
INSTALL
IMPORT
SIG · BABEL-HELPERS
B
babel-helpers
serializationjavascriptv6.24.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.

get
import { get } from 'babel-helpers'
import helpers from 'babel-helpers'
Default export is not available. Use named import for the 'get' function.
list
import { list } from 'babel-helpers'
const list = require('babel-helpers').list
Note that list() returns an array of all helper names. In CJS, require is fine.
all
import * as helpers from 'babel-helpers'
const helpers = require('babel-helpers')
In ESM, use namespace import to access both 'get' and 'list' as properties.

Demonstrates importing and using the 'get' function to retrieve a helper by name, and checking its AST type with babel-types.

import { get } from 'babel-helpers'; import * as t from 'babel-types'; const typeofHelper = get('typeof'); console.log(t.isExpressionStatement(typeofHelper)); // true
Debug
Known issues
breakingbabel-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.
fix
Update to latest v7.x or v8.x and prefer using plugins that handle helpers automatically.
affects: >=6.0.0
deprecatedSome helpers may be deprecated in future versions. Always check the changelog for deprecations.
fix
Stay updated with Babel releases and use the specific plugin that provides the helper.
affects: >=7.0.0
gotchaImporting from 'babel-helpers' does not work in browser environments without a bundler. The package is designed for Node.js and requires transformation.
fix
Use a bundler like webpack or rollup with babel-loader to include helpers.
affects: *
gotchaThe 'get' function expects a string name and returns an AST node. If the name is invalid, it may throw or return undefined.
fix
Validate helper names using the 'list' function or refer to the Babel source code.
affects: *
Errors
Common errors & fixes
Cannot find module 'babel-helpers'
Package is not installed or not in node_modules.
fix
Run npm install --save-dev babel-helpers
TypeError: helpers.get is not a function
Importing the default export instead of the named export.
fix
Use import { get } from 'babel-helpers' instead of import helpers from 'babel-helpers'
Error: Unknown helper: myHelper
Requested helper name does not exist.
fix
Use helpers.list() to get all available helper names.
Upgrade
Version history
6.24.1latest on npm
Audit
Dependencies
babel-typesoptionalUsed in examples and internally for AST node creation
Agent activity
17 hits · last 30 days
node
12
OpenAI (training)
1
Resources
babel-helpers — npm install babel-helpers · libregistry