gulp-best-rollup
raw JSON → 2.0.0 verified Mon Apr 27 auth: no javascript maintenance
Gulp plugin wrapping Rollup for ES module bundling, upgraded to ESM and Gulp v4. Latest version: 2.0.0. Provides a simple pipeable interface to integrate Rollup into Gulp workflows, supporting sourcemaps and custom Rollup config. Differentiates from gulp-better-rollup by being ESM-only and compatible with Rollup 3.x. Release cadence: low.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module not supported ↓
cause Using CommonJS require() to import an ESM-only package.
fix
Switch to import syntax and ensure your project is configured for ESM (e.g., 'type': 'module' in package.json).
error Cannot find module 'rollup' ↓
cause Missing peer dependency 'rollup'.
fix
Run npm i -D rollup@^3.1.0.
error Gulp version mismatch: gulp is not a function or pipe is not a function ↓
cause Using Gulp v3 with this plugin.
fix
Upgrade Gulp to v4 (gulp@^4.0.0).
Warnings
breaking Package is ESM-only; does not support CommonJS require(). ↓
fix Use import syntax or downgrade to a CJS-compatible alternative like gulp-better-rollup.
breaking Requires Rollup 3.x as peer dependency; incompatible with Rollup 2.x or 4.x. ↓
fix Install rollup@^3.1.0 alongside this package.
breaking Requires Node.js >= 14 and Gulp v4; not compatible with older versions. ↓
fix Upgrade Node.js to >=14 and Gulp to v4.
gotcha Package name does not match npm registry name. npm name is 'gulp-best-rollup', not 'gulp-rollup-plugin'. ↓
fix Install as npm i -D gulp-best-rollup.
Install
npm install gulp-rollup-plugin yarn add gulp-rollup-plugin pnpm add gulp-rollup-plugin Imports
- default wrong
const rollup = require('gulp-best-rollup')correctimport rollup from 'gulp-best-rollup' - default wrong
import * as rollup from 'gulp-best-rollup'correctimport rollup from 'gulp-best-rollup' - default wrong
import { rollup } from 'gulp-best-rollup'correctimport rollup from 'gulp-best-rollup'
Quickstart
import gulp from 'gulp';
import sourcemaps from 'gulp-sourcemaps';
import rollup from 'gulp-best-rollup';
export function js() {
return gulp.src('./src/index.js')
.pipe(sourcemaps.init())
.pipe(rollup({
plugins: []
}, {
file: 'index.js',
format: 'esm'
}))
.pipe(sourcemaps.write(''))
.pipe(gulp.dest('dist'));
}