Registry / devops / babel-helper-modules

babel-helper-modules

JSON →
library6.0.0jsnpmunverified

Provides Babel's internal helper functions (like _classCallCheck, _extends, etc.) as individual ES5 modules that can be imported directly. Version 6.0.0 is the latest stable release. Unlike babel-runtime which bundles core-js, this package avoids core-js dependencies, giving users freedom to choose their own polyfill (e.g., @babel/polyfill). Designed to be used with babel-plugin-transform-helper-modules to replace helper calls with direct imports, reducing bundle size and avoiding duplicate helper code. Supports only CommonJS require syntax and is intended for Node/Babel build pipelines.

npm install babel-helper-modules
INSTALL
IMPORT
SIG · BABEL-HELPER-MODUL
B
babel-helper-modules
devopsjavascriptv6.0.0
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.

classCallCheck
var classCallCheck = require('babel-helper-modules').classCallCheck;
import { classCallCheck } from 'babel-helper-modules';
This package does not ship ESM; only CommonJS require is supported.
extends
var _extends = require('babel-helper-modules').extends;
import extends from 'babel-helper-modules';
The helper name 'extends' conflicts with a JavaScript reserved word; assign to a different variable.
objectWithoutProperties
var objectWithoutProperties = require('babel-helper-modules').objectWithoutProperties;
import { objectWithoutProperties } from 'babel-helper-modules';
CommonJS only; no default export.

Shows importing and using multiple Babel helper modules from the package, demonstrating classCallCheck, inherits, extends, objectWithoutProperties, and possibleConstructorReturn.

var classCallCheck = require('babel-helper-modules').classCallCheck; var inherits = require('babel-helper-modules').inherits; var extendsHelper = require('babel-helper-modules').extends; var objectWithoutProperties = require('babel-helper-modules').objectWithoutProperties; var possibleConstructorReturn = require('babel-helper-modules').possibleConstructorReturn; // Example usage function Child() { classCallCheck(this, Child); var self = possibleConstructorReturn(this, (Child.__proto__ || Object.getPrototypeOf(Child)).call(this)); return self; } inherits(Child, Parent); var _ref = someObject; var a = _ref.a; var rest = objectWithoutProperties(_ref, ['a']); var newObj = extendsHelper({}, rest, { b: 2 });
Debug
Known issues
gotchaPackage is CommonJS-only; ESM import patterns (import/export) will fail. Only use require().
fix
Use `var helper = require('babel-helper-modules').helperName;` instead of `import`.
affects: >=6.0.0
gotchaThe helper name 'extends' must be aliased when assigning because 'extends' is a reserved word in JavaScript.
fix
Assign to a different variable name: `var _extends = require('babel-helper-modules').extends;`
affects: >=6.0.0
deprecatedThis package is a legacy artifact from Babel 6 era. Babel 7 uses @babel/helpers and @babel/runtime. New projects should prefer @babel/runtime with appropriate transform plugin.
fix
Migrate to @babel/runtime and @babel/plugin-transform-runtime for Babel 7+.
affects: >=6.0.0
gotchaNo TypeScript type definitions are provided. Using this package in a TypeScript project will require manual type declarations.
fix
Create a custom .d.ts file or use `require` with `@ts-ignore`.
affects: >=6.0.0
gotchaPackage does not include core-js polyfills; you must provide your own polyfill (e.g., @babel/polyfill) for instance methods like Array.prototype.find.
fix
Add @babel/polyfill or core-js to your project and import it early.
affects: >=6.0.0
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Trying to use ES import syntax with a CommonJS-only package.
fix
Change to `var helper = require('babel-helper-modules').helperName;`
TypeError: _classCallCheck is not a function
Incorrectly accessing the helper (e.g., importing default instead of named).
fix
Ensure you use `require('babel-helper-modules').classCallCheck` and not `require('babel-helper-modules')` alone.
Uncaught SyntaxError: Unexpected token 'extends'
Variable name 'extends' is reserved; using it as a variable name without renaming.
fix
Rename the imported helper: `var _extends = require('babel-helper-modules').extends;`
Module not found: Error: Can't resolve 'babel-helper-modules'
Package not installed or missing from node_modules.
fix
Run `npm install babel-helper-modules --save` or `yarn add babel-helper-modules`.
Upgrade
Version history
6.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
babel-helper-modules — npm install babel-helper-modules · libregistry