{"id":10987,"library":"gulp-babel","title":"Gulp Babel Transpiler","description":"gulp-babel is a Gulp plugin that seamlessly integrates Babel into your Gulp build pipeline, enabling the transpilation of modern JavaScript features to widely supported versions. The current stable release is v8.0.0, which provides full compatibility with Babel 7.x. This package is actively maintained by the Babel team, with major version bumps often aligning with core Babel releases, ensuring up-to-date support for the latest JavaScript syntax. It serves as a thin wrapper around Babel's transformation API, exposing a flexible `.pipe()` method for Gulp streams. Key differentiators include its tight integration with the Gulp ecosystem, handling aspects like source map generation via `gulp-sourcemaps`, and providing access to Babel's transformation metadata on processed files. It relies on `@babel/core` as a crucial peer dependency for its core functionality, distinguishing it from direct Babel CLI usage by stream-centric processing.","status":"active","version":"8.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/babel/gulp-babel","tags":["javascript","gulpplugin","babel","transpiler","es2015","es2016","es2017","rewriting","transformation"],"install":[{"cmd":"npm install gulp-babel","lang":"bash","label":"npm"},{"cmd":"yarn add gulp-babel","lang":"bash","label":"yarn"},{"cmd":"pnpm add gulp-babel","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for Babel's core transpilation functionality. It is specified as a peer dependency.","package":"@babel/core","optional":false}],"imports":[{"note":"The package exports a default function. For CommonJS, use `require('gulp-babel')`. For ESM, use `import babel from 'gulp-babel'`.","wrong":"const { babel } = require('gulp-babel');","symbol":"babel","correct":"import babel from 'gulp-babel';"}],"quickstart":{"code":"const gulp = require('gulp');\nconst babel = require('gulp-babel');\nconst sourcemaps = require('gulp-sourcemaps');\nconst concat = require('gulp-concat');\n\ngulp.task('default', () =>\n\tgulp.src('src/**/*.js')\n\t\t.pipe(sourcemaps.init())\n\t\t.pipe(babel({\n\t\t\tpresets: ['@babel/env']\n\t\t}))\n\t\t.pipe(concat('all.js'))\n\t\t.pipe(sourcemaps.write('.'))\n\t\t.pipe(gulp.dest('dist'))\n);\n\n// To run this, ensure you have:\n// npm install --save-dev gulp gulp-babel @babel/core @babel/preset-env gulp-sourcemaps gulp-concat\n// A 'src' directory with some .js files.","lang":"javascript","description":"This quickstart demonstrates how to set up a basic Gulp task to transpile JavaScript files using Babel, including source map generation and concatenation."},"warnings":[{"fix":"Ensure `@babel/core` is installed as a dev dependency (`npm install --save-dev @babel/core`) and remove `babel-core` if present.","message":"Starting with v8.0.0 (and its beta releases), the peer dependency for Babel's core was changed from `babel-core` to the scoped package `@babel/core`.","severity":"breaking","affected_versions":">=8.0.0-beta.0"},{"fix":"Upgrade Node.js to a supported version (>=6 for v8) and ensure `babel-core` (for v7) or `@babel/core` (for v8) is explicitly installed as a peer dependency.","message":"Version 7.0.0 dropped support for older Node.js versions (0.10 and 0.12) and transitioned `babel-core` to a peer dependency instead of a direct dependency.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Refer to the Babel 6 upgrade guide and `gulp-babel` documentation for v6 to adjust configuration files and plugin usage. Downgrade `gulp-babel` to v5 if still using Babel 5.","message":"Version 6.0.0 marked a significant upgrade to Babel 6.0.0, introducing major changes in Babel's configuration and plugin ecosystem.","severity":"breaking","affected_versions":"6.0.0"},{"fix":"Install `@babel/plugin-transform-runtime` and `@babel/runtime`, then add `@babel/plugin-transform-runtime` to your Babel plugins configuration within `gulp-babel` options.","message":"When using advanced JavaScript features like generators or async/await, you may encounter `regeneratorRuntime is not defined` errors at runtime.","severity":"gotcha","affected_versions":">=6.0.0"},{"fix":"Remove `sourceMap` and `filename` from the `babel()` options. Source maps should be managed using `gulp-sourcemaps`.","message":"Some Babel options, specifically `sourceMap` and `filename`, are handled internally by `gulp-babel` and should not be explicitly set in the Babel options passed to the plugin.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev @babel/core` to install the core Babel package.","cause":"The `@babel/core` package, a required peer dependency, is not installed.","error":"Error: Cannot find module '@babel/core'"},{"fix":"Install `@babel/plugin-transform-runtime` and `@babel/runtime` (`npm install --save-dev @babel/plugin-transform-runtime && npm install --save @babel/runtime`) and add `@babel/plugin-transform-runtime` to your Babel configuration plugins.","cause":"Using features like async/await or generators without including Babel's runtime transformations.","error":"ReferenceError: regeneratorRuntime is not defined"},{"fix":"Correct the import statement to `const babel = require('gulp-babel');` instead of `const { babel } = require('gulp-babel');`.","cause":"Attempting to destructure a default export in CommonJS when the module's default export is the function itself.","error":"TypeError: (0 , _gulpBabel.default) is not a function"}],"ecosystem":"npm"}