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.
npm install gulp-babelVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up a basic Gulp task to transpile JavaScript files using Babel, including source map generation and concatenation.
Ensure `@babel/core` is installed as a dev dependency (`npm install --save-dev @babel/core`) and remove `babel-core` if present.
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.
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.
Install `@babel/plugin-transform-runtime` and `@babel/runtime`, then add `@babel/plugin-transform-runtime` to your Babel plugins configuration within `gulp-babel` options.
Remove `sourceMap` and `filename` from the `babel()` options. Source maps should be managed using `gulp-sourcemaps`.
Run `npm install --save-dev @babel/core` to install the core Babel package.
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.
Correct the import statement to `const babel = require('gulp-babel');` instead of `const { babel } = require('gulp-babel');`.