{"id":13274,"library":"gulp-rollup","title":"Gulp Rollup Plugin","description":"gulp-rollup is a Gulp plugin designed to integrate the Rollup ES6 module bundler into a Gulp workflow. Currently at version 2.17.0, its release cadence appears to be very slow, if not effectively halted, largely due to the maintainers' strong recommendation to use alternative solutions for most common use cases. The plugin's core differentiator is its ability to process files that have been synthesized or transformed *within* Gulp's virtual filesystem before being passed to Rollup. However, this approach necessitates that every file expected to be imported by Rollup is preemptively loaded into memory, making it inefficient and generally 'not appropriate for most use cases' due to potential performance and memory issues, especially with larger projects. Developers are strongly encouraged to consider `rollup-stream` for standard bundling needs or `rollup-plugin-gulp` for integrating Gulp transforms as Rollup plugins. This package primarily serves niche scenarios where extensive in-Gulp file synthesis is unavoidable before bundling.","status":"maintenance","version":"2.17.0","language":"javascript","source_language":"en","source_url":"https://github.com/mcasimir/gulp-rollup","tags":["javascript","gulp","gulpplugin","rollup","es6"],"install":[{"cmd":"npm install gulp-rollup","lang":"bash","label":"npm"},{"cmd":"yarn add gulp-rollup","lang":"bash","label":"yarn"},{"cmd":"pnpm add gulp-rollup","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for Gulp task runner integration.","package":"gulp","optional":false},{"reason":"The underlying module bundler wrapped by this plugin.","package":"rollup","optional":false},{"reason":"Commonly used for source map generation within Gulp workflows.","package":"gulp-sourcemaps","optional":true}],"imports":[{"note":"CommonJS require() syntax is used; this plugin typically integrates into Gulp setups which historically use CommonJS.","wrong":"import rollup from 'gulp-rollup';","symbol":"rollup","correct":"const rollup = require('gulp-rollup');"},{"note":"Standard CommonJS import for the Gulp task runner.","wrong":"import gulp from 'gulp';","symbol":"gulp","correct":"const gulp = require('gulp');"},{"note":"CommonJS import for integrating source map functionality.","wrong":"import sourcemaps from 'gulp-sourcemaps';","symbol":"sourcemaps","correct":"const sourcemaps = require('gulp-sourcemaps');"}],"quickstart":{"code":"var gulp       = require('gulp'),\n    rollup     = require('gulp-rollup'),\n    sourcemaps = require('gulp-sourcemaps');\n\ngulp.task('bundle', function() {\n  return gulp.src('./src/**/*.js')\n    .pipe(sourcemaps.init())\n      // Transform files here if needed, before Rollup processes them.\n      .pipe(rollup({\n        // Any option supported by Rollup can be set here.\n        // 'input' is mandatory, 'output' options are handled by gulp.dest()\n        input: './src/main.js',\n        // Example Rollup option: allow external modules\n        external: ['lodash']\n      }))\n    .pipe(sourcemaps.write('./maps')) // Writes sourcemaps to a 'maps' subdirectory in dest\n    .pipe(gulp.dest('./dist'));\n});","lang":"javascript","description":"Demonstrates bundling ES6 modules with Rollup in a Gulp task, including source map generation and a basic Rollup configuration."},"warnings":[{"fix":"For most scenarios, use `rollup-stream` or `rollup-plugin-gulp` instead. Only use `gulp-rollup` if extensive in-Gulp file synthesis is absolutely necessary before bundling.","message":"This plugin is generally not recommended for most use cases. It requires all files to be loaded into memory preemptively, leading to potential performance and memory issues for larger projects.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Avoid `options.allowRealFiles`. Ensure all necessary files are included in the Gulp stream via `gulp.src()` or utilize Rollup plugins for complex file handling and transformations.","message":"Using `options.allowRealFiles: true` breaks Gulp plugin guidelines by allowing Rollup to read files directly from the filesystem, bypassing the Gulp stream.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If you must use `gulp-rollup`, consider breaking up your Gulp tasks into smaller, more manageable streams or processing files in batches to mitigate memory pressure. Prefer `rollup-stream` for better memory efficiency.","message":"High memory consumption can occur with projects containing a large number of files, as all files are loaded into memory before Rollup processing.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure all files referenced by Rollup, including external modules, are included in your `gulp.src()` glob patterns. Alternatively, if appropriate for your use case, configure Rollup's `external` option or use `options.allowRealFiles: true` with caution.","cause":"`gulp-rollup` expects all files, including their dependencies, to be present within the Gulp stream for Rollup to resolve them.","error":"RollupError: Could not resolve 'module-name' from './path/to/file.js'"},{"fix":"This is a direct consequence of the plugin's design. If possible, refactor your build process to use `rollup-stream` which handles files more efficiently. If `gulp-rollup` is essential, try to process fewer files at a time or increase Node.js's memory limit (e.g., `node --max-old-space-size=4096 gulp bundle`).","cause":"Too many files are being loaded into memory simultaneously by Gulp before being processed by Rollup, exceeding Node.js's heap limit.","error":"JavaScript heap out of memory / FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null}