The `gulp-esbuild` package provides a Gulp plugin that integrates the high-performance `esbuild` bundler into Gulp-based build workflows. It allows developers to efficiently bundle, minify, and transform JavaScript and TypeScript assets as part of their Gulp pipelines, leveraging `esbuild`'s speed. The current stable version is 0.14.1, and the package frequently releases updates, often in response to breaking changes in the upstream `esbuild` library. A key feature is the ability to enable `esbuild`'s incremental build mode via the `createGulpEsbuild` factory function, which significantly speeds up rebuilds during development when combined with Gulp's `watch` API. Unlike direct `esbuild` usage, `gulp-esbuild` is designed to work with Gulp's virtual file streams, but it has a specific limitation: all input files specified in `gulp.src()` must physically exist on the filesystem, even if their contents are subsequently modified by earlier Gulp pipeline steps.
npm install gulp-esbuildVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to bundle a TypeScript file (`index.tsx`) using `gulp-esbuild` into a single JavaScript file (`bundle.js`) and output it to the `dist` directory, including minification and sourcemaps.
Run `npm install gulp-esbuild esbuild` or `yarn add gulp-esbuild esbuild` to ensure both packages are installed.
Remove the `{ pipe: true }` option from any calls to `createGulpEsbuild`. The `createGulpEsbuild` function itself is still necessary for enabling incremental builds.Ensure all source files specified in `gulp.src()` exist on disk. For dynamically generated content, consider writing it to a temporary file before passing it to `gulp-esbuild`.
Consult the `esbuild` release notes (often linked in `gulp-esbuild` changelogs) and update your `esbuild` configuration options accordingly after upgrading `gulp-esbuild`.
Import `createGulpEsbuild` and instantiate the plugin with `const gulpEsbuildInstance = createGulpEsbuild({ incremental: true });` then use `gulpEsbuildInstance` in your pipeline.Install esbuild alongside gulp-esbuild: `npm install esbuild gulp-esbuild` or `yarn add esbuild gulp-esbuild`.
Remove the `{ pipe: true }` option from your `createGulpEsbuild` configuration. The plugin now handles both file system and virtual files by default.Ensure that all files processed by `gulp-esbuild` (i.e., those passed into `gulp.src()`) have a corresponding physical file on disk. If generating content virtually, write it to a temporary file first.