Skip to content

Commit

Permalink
Merge pull request #1463 from diervo/amdOptionsFix
Browse files Browse the repository at this point in the history
Run same options transform on generate for bundle
  • Loading branch information
Rich-Harris committed Jul 9, 2017
2 parents dcda451 + 30b74db commit c026cb2
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/rollup.js
Expand Up @@ -44,15 +44,7 @@ const ALLOWED_KEYS = [
'watch'
];

function checkOptions ( options ) {
if ( !options ) {
throw new Error( 'You must supply an options object to rollup' );
}

if ( options.transform || options.load || options.resolveId || options.resolveExternal ) {
throw new Error( 'The `transform`, `load`, `resolveId` and `resolveExternal` options are deprecated in favour of a unified plugin API. See https://github.com/rollup/rollup/wiki/Plugins for details' );
}

function checkAmd ( options ) {
if ( options.moduleId ) {
if ( options.amd ) throw new Error( 'Cannot have both options.amd and options.moduleId' );

Expand All @@ -66,6 +58,18 @@ function checkOptions ( options ) {
console.warn( msg ); // eslint-disable-line no-console
}
}
}

function checkOptions ( options ) {
if ( !options ) {
throw new Error( 'You must supply an options object to rollup' );
}

if ( options.transform || options.load || options.resolveId || options.resolveExternal ) {
throw new Error( 'The `transform`, `load`, `resolveId` and `resolveExternal` options are deprecated in favour of a unified plugin API. See https://github.com/rollup/rollup/wiki/Plugins for details' );
}

checkAmd (options);

const err = validateKeys( keys(options), ALLOWED_KEYS );
if ( err ) throw err;
Expand All @@ -92,6 +96,8 @@ export function rollup ( options ) {
options.format = 'es';
}

checkAmd( options );

timeStart( '--GENERATE--' );

const rendered = bundle.render( options );
Expand Down

0 comments on commit c026cb2

Please sign in to comment.