Browse Source

more fixes

declarations-and-references
Rich-Harris 9 years ago
parent
commit
88f373e10a
  1. 1
      src/Module.js
  2. 9
      src/finalisers/shared/getExportBlock.js

1
src/Module.js

@ -358,6 +358,7 @@ export default class Module {
return { strongDependencies, weakDependencies };
}
// TODO this seems superfluous
defaultName () {
const defaultExport = this.exports.default;

9
src/finalisers/shared/getExportBlock.js

@ -8,8 +8,13 @@ export default function getExportBlock ( bundle, exportMode, mechanism = 'return
const prop = name === 'default' ? `['default']` : `.${name}`;
const declaration = bundle.entryModule.traceExport( name );
if ( declaration.isReassigned ) return null;
return `exports${prop} = ${declaration.render( false )};`;
const lhs = `exports${prop}`;
const rhs = declaration.render( false );
// prevent `exports.count = exports.count`
if ( lhs === rhs ) return null;
return `${lhs} = ${rhs};`;
})
.filter( Boolean )
.join( '\n' );

Loading…
Cancel
Save