{"id":20077,"library":"gulp-babel-globals","title":"gulp-babel-globals","description":"Gulp plugin for babel-globals that allows you to define global variable names for Babel modules during a Gulp build pipeline. Version 2.0.0 is the latest stable release, with no frequent updates. It wraps babel-globals (v2.x) to integrate with Gulp streams. Differentiators: it provides a Gulp-friendly API for handling ES6 module globals, which is useful for legacy builds or specific bundling needs. Alternatives include using Babel directly with custom plugins.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/mairatma/gulp-babel-globals","tags":["javascript","babel","es6","globals","gulp"],"install":[{"cmd":"npm install gulp-babel-globals","lang":"bash","label":"npm"},{"cmd":"yarn add gulp-babel-globals","lang":"bash","label":"yarn"},{"cmd":"pnpm add gulp-babel-globals","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core library that handles the actual module-to-global transformation","package":"babel-globals","optional":false},{"reason":"Peer dependency for stream piping","package":"gulp","optional":true}],"imports":[{"note":"CommonJS require works, but ESM import is preferred for modern projects","wrong":"const babelGlobals = require('gulp-babel-globals')","symbol":"default","correct":"import babelGlobals from 'gulp-babel-globals'"},{"note":"Namespace import to access all exports","symbol":"gulpBabelGlobals","correct":"import * as gulpBabelGlobals from 'gulp-babel-globals'"},{"note":"The package exports a single function as default; named import will be undefined","wrong":"import { babelGlobals } from 'gulp-babel-globals'","symbol":"default","correct":"const babelGlobals = require('gulp-babel-globals')"}],"quickstart":{"code":"const gulp = require('gulp');\nconst babelGlobals = require('gulp-babel-globals');\n\ngulp.task('globals', () => {\n  return gulp.src('src/**/*.js')\n    .pipe(babelGlobals({ bundleFileName: 'myBundle.js' }))\n    .pipe(gulp.dest('dist'));\n});","lang":"javascript","description":"Shows basic usage: pipe JavaScript files through gulp-babel-globals with options"},"warnings":[{"fix":"Ensure input files have .js extension or configure gulp.src accordingly.","message":"The plugin only processes files ending in .js; other extensions are ignored silently.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Always provide a 'bundleFileName' option in the options object.","message":"The 'bundleFileName' option is required but not validated; missing it may cause errors.","severity":"deprecated","affected_versions":"2.0.0"},{"fix":"Use an alternative approach for Babel 7 or higher, such as custom Gulp transforms.","message":"This plugin is not compatible with Babel 7+ because babel-globals has not been updated.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install babel-globals' alongside gulp-babel-globals.","cause":"babel-globals is a peer dependency that must be installed separately.","error":"Cannot find module 'babel-globals'"},{"fix":"Use 'const babelGlobals = require(\"gulp-babel-globals\")' or 'import babelGlobals from \"gulp-babel-globals\"'.","cause":"Incorrect import: using named import instead of default import.","error":"TypeError: babelGlobals is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}