const gulp = require( 'gulp' );
const rollup = require( 'gulp-rollup-stream' );
gulp.task( 'rollup', function() {
return gulp.src( 'src/main.js' )
.pipe(rollup({
format: 'cjs'
})
.pipe( gulp.dest( 'build' ) )
;
});
Create a rollup-stream. Check Rollup documenation for more options
- bundleCb: Everytime a new bundle this callback is called using:
bundleCb( bundle )
Useful for cache:
var cache;
function bundleCb( bundle ) { cache = bundle; }
- options.root: The path where to look at modules at first when using
import mod from 'my/module'.
It will look intopath.resolve( options.root, 'my/module' );
-
Rollup Options
-
Generate Options
-
options.rollup
If an object, this option will be merged directly to the options passed to rollup.rollup( options ).
If a function, will be called with the first parameter the options that will be passed to rollup.rollup and a second extra parameter with many other infos. If this function return a promise, it will be resolved before it is passed to rollup
-
options.generate Same as above, but for generate