rollup-stream

raw JSON →
1.24.1 verified Mon Apr 27 auth: no javascript deprecated

A wrapper around Rollup that returns a readable stream instead of a Promise, designed to integrate Rollup with Gulp. Works with Rollup options passed directly, supports caching, sourcemaps, and custom Rollup versions. Last updated 2018-06-17, pinned to Rollup <1.0.0 (pre-Rollup 1.0 API). Not compatible with Rollup 1.0+ due to breaking API changes. Alternatives: gulp-rollup, @rollup/plugin-buble.

error Error: Cannot find module 'rollup'
cause rollup is a peer dependency; not installed automatically.
fix
npm install rollup@0.68.2 (or any 0.x version)
error TypeError: rollupStream is not a function
cause Default import/require mishandled – package exports default, not named.
fix
const rollupStream = require('rollup-stream').default; or use ES import with default.
error The "path" argument must be of type string. Received undefined
cause Missing 'input' option or invalid path.
fix
Ensure rollupStream({input: './src/main.js'}) with correct path.
error Error: You must specify input and output options.
cause rollup 0.x required both options; rollup-stream passes all to both rollup and generate.
fix
Rollup 0.x expects output options like dest, format. Pass them as top-level or use output key.
breaking Incompatible with Rollup >= 1.0.0. Options API changed; rollup-stream expects old Rollup 0.x options.
fix Use gulp-rollup or @rollup/plugin-buble instead, or downgrade Rollup to <1.0.0.
deprecated Package is effectively unmaintained (last publish 2018). Not designed for Rollup 1/2/3.
fix Migrate to gulp-rollup or directly use Rollup API with gulp-wrapper.
gotcha Options object is passed directly to both rollup() and generate() – no validation of overlapping options.
fix Ensure options do not conflict between input (rollup) and output (generate) settings.
gotcha Caching: The 'bundle' event must be listened on the stream before piping, else cache won't update effectively.
fix Attach .on('bundle', callback) directly to the rollupStream() return value before any .pipe().
npm install rollup-stream
yarn add rollup-stream
pnpm add rollup-stream

Bundle with Rollup via Gulp using rollup-stream, converting the readable stream to a vinyl file.

const gulp = require('gulp');
const rollupStream = require('rollup-stream');
const source = require('vinyl-source-stream');

gulp.task('bundle', function() {
  return rollupStream({
    input: './src/main.js'
  })
  .pipe(source('app.js'))
  .pipe(gulp.dest('./dist'));
});