Skip to content

Commit

Permalink
multi-entry support in core rollup lib
Browse files Browse the repository at this point in the history
  • Loading branch information
tivac committed Aug 19, 2016
1 parent f8129e4 commit f489050
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { writeFile } from './utils/fs.js';
import { assign, keys } from './utils/object.js';
import { mapSequence } from './utils/promise.js';
import validateKeys from './utils/validateKeys.js';
import ensureArray from './utils/ensureArray.js';
import SOURCEMAPPING_URL from './utils/sourceMappingURL.js';
import Bundle from './Bundle.js';

Expand Down Expand Up @@ -52,7 +53,10 @@ export function rollup ( options ) {
return Promise.reject( error );
}

const bundle = new Bundle( options );
const entries = ensureArray(options.entry);

return Promise.all( entries.map( entry => {
const bundle = new Bundle( assign( { }, options, { entry } ) );

return bundle.build().then( () => {
function generate ( options ) {
Expand All @@ -74,7 +78,9 @@ export function rollup ( options ) {
exports: keys( bundle.entryModule.exports ),
modules: bundle.orderedModules.map( module => module.toJSON() ),

entry,
generate,

write: options => {
if ( !options || !options.dest ) {
throw new Error( 'You must supply options.dest to bundle.write' );
Expand Down Expand Up @@ -112,4 +118,6 @@ export function rollup ( options ) {

return result;
});
}))
.then( results => results.length === 1 ? results[0] : results );
}

0 comments on commit f489050

Please sign in to comment.