Browse Source

Handle options.external is a function.

semi-dynamic-namespace-imports
operandom 9 years ago
parent
commit
9461ed325e
  1. 13
      bin/src/runRollup.js

13
bin/src/runRollup.js

@ -95,8 +95,15 @@ const equivalents = {
};
function execute ( options, command ) {
let external = ( options.external || [] )
.concat( command.external ? command.external.split( ',' ) : [] );
let external = command.external ?
typeof options.external === 'function' ?
((fn, a) => {
return function (id) {
return fn() || a.indexOf(id) !== -1;
};
})(options.external, command.external.split(',')) :
(options.external || []).concat(command.external.split(',')) :
options.external;
if ( command.globals ) {
let globals = Object.create( null );
@ -218,4 +225,4 @@ function bundle ( options ) {
process.stdout.write( code );
});
}
}
Loading…
Cancel
Save