Browse Source

preserve original statement order where possible

contingency-plan
Rich Harris 10 years ago
parent
commit
7c334269ba
  1. 14
      src/Module.js

14
src/Module.js

@ -297,8 +297,18 @@ export default class Module {
let allStatements = [];
return sequence( this.statements, statement => {
// skip already-included statements
if ( statement.isIncluded ) return;
// A statement may have already been included, in which case we need to
// curb rollup's enthusiasm and move it down here. It remains to be seen
// if this approach is bulletproof
if ( statement.isIncluded ) {
const index = allStatements.indexOf( statement );
if ( ~index ) {
allStatements.splice( index, 1 );
allStatements.push( statement );
}
return;
}
// skip import declarations...
if ( statement.isImportDeclaration ) {

Loading…
Cancel
Save