JSPM

  • Created
  • Published
  • Downloads 3975
  • Score
    100M100P100Q114862F
  • License MIT

gulp plugin for Rollup ES6 module bundler

Package Exports

  • gulp-rollup

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-rollup) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gulp-rollup npm Dependency Status Build Status

This plugin allows gulp to populate a virtual filesystem and feed it to the Rollup ES6 module bundler.

Note: This plugin is not appropriate for most use cases, as it requires every file expected to be imported by Rollup to be loaded into memory preemptively. rollup-stream is preferred for almost all purposes. If you want to transform/synthesize/alias/etc. the files Rollup processes, use Rollup plugins; if there's no Rollup plugin to do what you want, try the gulp-to-Rollup plugin adapter, rollup-plugin-gulp. If you really need to synthesize your files in gulp, go ahead and use gulp-rollup—that's what it's made for.

Install

npm install --save-dev gulp-rollup

Usage

var gulp       = require('gulp'),
    rollup     = require('gulp-rollup');

gulp.task('bundle', function() {
  gulp.src('./src/**/*.js')
    // transform the files here.
    .pipe(rollup({
      // any option supported by Rollup can be set here.
      entry: './src/main.js'
    }))
    .pipe(gulp.dest('./dist'));
});

Usage with sourcemaps

var gulp       = require('gulp'),
    rollup     = require('gulp-rollup'),
    sourcemaps = require('gulp-sourcemaps');

gulp.task('bundle', function() {
  gulp.src('./src/**/*.js')
    .pipe(sourcemaps.init())
      // transform the files here.
      .pipe(rollup({
        entry: './src/main.js'
      }))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('./dist'));
});

Options

In addition to the standard Rollup options, gulp-rollup supports options.rollup, allowing you to use an older, newer, or custom version of Rollup by passing in the module like so:

gulp.src('./src/**/*.js')
  .pipe(rollup({
    rollup: require('rollup'),
    entry: './src/main.js'
  }))
  //...

If options.allowRealFiles is set to true, gulp-rollup will break the gulp plugin guidelines just for you and allow Rollup to read files directly from the filesystem when a file with a matching name isn't found in the gulp stream. You could use this to weasel your way out of having to use rollup-stream, but that would make you a terrible person.