Registry / devops / gulp-better-rollup

gulp-better-rollup

JSON →
library4.0.1jsnpmunverified

gulp-better-rollup is a Gulp plugin designed to integrate the Rollup ES6 module bundler into a Gulp build pipeline. Released with its last stable version 4.0.1 in March 2019, it relies on Rollup `^1.4.1` as a peer dependency. This makes it incompatible with Rollup versions 2, 3, and the current major version 4, which has seen active development since then. Its key differentiator compared to the older `gulp-rollup` is a deeper integration with Gulp's stream, where it processes file paths from `gulp.src()` rather than in-memory buffers. This approach aims to give developers more control over the Gulp pipeline, but comes with specific caveats regarding pre-processing plugins and Rollup option handling. Given its last update date and peer dependency on a significantly older Rollup version, its release cadence is non-existent, and it is effectively superseded by other approaches for modern Rollup usage.

npm install gulp-better-rollup
INSTALL
IMPORT
SIG · GULP-BETTER-ROLLUP
G
gulp-better-rollup
devopsjavascriptv4.0.1
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.

rollup
const rollup = require('gulp-better-rollup');
import rollup from 'gulp-better-rollup';
This package is CommonJS-only and not designed for direct ESM import. Node.js `require` is the correct way.
gulp
const gulp = require('gulp');
Standard Gulp plugin usage employs CommonJS `require`.
babel
const babel = require('rollup-plugin-babel');
Rollup plugins like babel are typically required separately and passed into `gulp-better-rollup`'s options.

Bundles ES6 modules from 'lib/index.js' using Rollup with Babel, generating a CommonJS output with inlined sourcemaps into the 'dist' directory.

const gulp = require('gulp'); const sourcemaps = require('gulp-sourcemaps'); const rollup = require('gulp-better-rollup'); const babel = require('rollup-plugin-babel'); gulp.task('lib-build', () => { return gulp.src('lib/index.js') .pipe(sourcemaps.init()) .pipe(rollup({ // The 'input' option is handled by gulp.src() and unsupported here. plugins: [babel()] }, { // The 'sourcemap' option is unsupported; use gulp-sourcemaps instead. format: 'cjs' })) // Inlining the sourcemap into the exported .js file .pipe(sourcemaps.write()) .pipe(gulp.dest('dist')); });
Debug
Known issues
breakingThis plugin is only compatible with Rollup `^1.4.1`. It does not support Rollup versions 2.x, 3.x, or the current 4.x. Attempting to use it with newer Rollup versions will lead to breakage.
fix
Ensure `rollup` peer dependency is installed at `^1.4.1`. For modern Rollup versions, consider alternatives like `@rollup/stream` or other Gulp-Rollup integrations.
affects: >=4.0.1
breakingThe Rollup `input` option is explicitly unsupported by `gulp-better-rollup`. The input file is determined by `gulp.src()`.
fix
Remove the `input` option from the Rollup configuration object passed to `gulp-better-rollup`. Rely on `gulp.src()` for input files.
affects: >=4.0.1
breakingRollup's native `sourcemap` option is unsupported. Source map generation must be handled by `gulp-sourcemaps`.
fix
Remove the `sourcemap` option from Rollup configuration. Use `gulp-sourcemaps.init()` before `gulp-better-rollup` and `gulp-sourcemaps.write()` after it in the pipeline.
affects: >=4.0.1
gotchaIf other Gulp plugins are used before `gulp-better-rollup` that perform source transformations, those transformations will be lost, as `gulp-better-rollup` processes file paths directly, bypassing previous buffer modifications.
fix
Place `gulp-better-rollup` early in the Gulp pipeline if file content transformations are expected. Ensure preceding plugins do not modify file contents if their output is critical.
affects: >=4.0.1
gotchaThe Rollup output `file` option is largely ignored or overridden. The output location is determined by `gulp.dest()`. If a full directory path is passed to Rollup's `file` option, only the file name part will be used. If `gulp.dest()` specifies a file path, Rollup's `file` argument is ignored entirely.
fix
Control the output file name and path primarily through `gulp.dest()` and `gulp-rename` if necessary, rather than relying on Rollup's `output.file` option.
affects: >=4.0.1
gotchaWhen using `gulp-sourcemaps` with `.mjs` extension files, the plugin may not insert the `//# sourceMappingURL=` linking comment, rendering external sourcemaps effectively useless for debugging.
fix
Consider inlining sourcemaps using `sourcemaps.write()` without arguments, or if external sourcemaps are essential, investigate alternative sourcemap generation or file extensions.
affects: >=4.0.1
Errors
Common errors & fixes
RollupError: You must supply an `input` option.
Attempting to specify the `input` option in the Rollup configuration object, which is handled by `gulp.src()`.
fix
Remove the `input` property from the first argument (inputOptions) passed to the `rollup` plugin.
Error: Rollup's 'sourcemap' option is not supported. Use 'gulp-sourcemaps' plugin instead.
Setting Rollup's `sourcemap` option directly in `gulp-better-rollup`'s configuration.
fix
Remove the `sourcemap` option from the Rollup configuration. Integrate `gulp-sourcemaps` into your Gulp pipeline before and after `gulp-better-rollup`.
Error: Cannot find module 'rollup'
The `rollup` peer dependency is either not installed or an incompatible version is installed (e.g., Rollup 2.x, 3.x, or 4.x).
fix
Run `npm install rollup@^1 --save-dev` to install the correct Rollup version.
Unexpected token (xx:yy) in file.js
Syntax error in source code, but `gulp-better-rollup`'s error reporting is less verbose than standalone Rollup.
fix
Examine the reported file and line number for JavaScript syntax errors. For better error reporting, consider using `rollup-plugin-terser` or similar plugins that can provide more detailed output, or debug with a pure Rollup setup first.
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies
rolluprequiredCore bundler, required as a peer dependency. Only compatible with Rollup `^1.4.1`. Modern Rollup versions (2.x, 3.x, 4.x) are incompatible.
Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources