Registry / devops / gulp-babel-helpers

gulp-babel-helpers

JSON →
library2.2.2jsnpmunverified

A gulp plugin that replaces gulp-babel by transpiling files with Babel while automatically collecting external helpers into a separate module. Version 2.2.2 is the latest stable release, with sporadic updates. It avoids polluting the global scope with babel helpers by generating a shared helpers file and injecting require statements into each transpiled file. Unlike gulp-babel or manual babel setup, it automates external helper management without global pollution.

npm install gulp-babel-helpers
INSTALL
IMPORT
SIG · GULP-BABEL-HELPERS
G
gulp-babel-helpers
devopsjavascriptv2.2.2
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.

babelHelpers
import babelHelpers from 'gulp-babel-helpers'
const babelHelpers = require('gulp-babel-helpers')
ESM default export; the package does not export named symbols
babelHelpers (as transform)
import babelHelpers from 'gulp-babel-helpers'; const transform = babelHelpers;
const { babelHelpers } = require('gulp-babel-helpers')
Common mistake: trying to destructure a non-existent named export
Require in CommonJS
const babelHelpers = require('gulp-babel-helpers').default || require('gulp-babel-helpers')
const babelHelpers = require('gulp-babel-helpers')
In CJS, default export is on .default in some Node versions; use the fallback pattern

Transpile JavaScript files with Babel and collect external helpers into a separate helpers.js file.

import gulp from 'gulp'; import babelHelpers from 'gulp-babel-helpers'; gulp.task('scripts', () => { return gulp.src('./src/**/*.js') .pipe(babelHelpers( { presets: ['@babel/preset-env'], plugins: ['@babel/plugin-transform-runtime'] }, './helpers.js' )) .pipe(gulp.dest('./dist')); });
Debug
Known issues
gotchaThe 'imaginaryLocationInSrc' parameter must be a relative path as if it existed in the source directory. Using an absolute path or incorrect relative path will cause broken require statements in the output.
fix
Ensure the second argument is a relative path from the source root, e.g., './helpers.js' for a file at src/helpers.js.
affects: >=2.0.0
gotchaIf the babel config does not include 'externalHelpers: true' or the necessary plugins, helpers may not be extracted correctly.
fix
Set '@babel/plugin-external-helpers' or 'externalHelpers: true' in your babel config.
affects: >=2.0.0
deprecatedPackage is no longer actively maintained; consider using '@babel/preset-env' with 'useBuiltIns' or 'babel-plugin-external-helpers' directly with gulp-babel.
fix
Switch to gulp-babel + babel-plugin-external-helpers or a more modern setup.
affects: >=2.2.0
Errors
Common errors & fixes
Error: Cannot find module 'gulp-babel-helpers'
Package not installed or missing in node_modules
fix
Run 'npm install gulp-babel-helpers --save-dev'
TypeError: babelHelpers is not a function
Incorrect import style (e.g., using destructured named import)
fix
Use 'import babelHelpers from ...' or 'const babelHelpers = require(...).default'
Error: Babel config must specify 'externalHelpers' option
Missing externalHelpers configuration in babel options
fix
Add 'externalHelpers: true' to your babel config object
Error: ENOENT: no such file or directory, open '.../helpers.js'
Imaginary location path does not match the generated file stream
fix
Ensure the second argument to babelHelpers matches the filename that will be created in the dest
Upgrade
Version history
2.2.2latest on npm
Audit
Dependencies
gulprequiredGulp plugin interface dependency
@babel/corerequiredTranspilation core
@babel/helpersrequiredExtracting external helpers
through2optionalStream transformation
Agent activity
4 hits · last 30 days
node
4
Resources
gulp-babel-helpers — npm install gulp-babel-helpers · libregistry