Browse Source

more fixes

contingency-plan
Rich-Harris 10 years ago
parent
commit
da00ac8a3c
  1. 16
      src/Bundle.js
  2. 1
      src/Module.js

16
src/Bundle.js

@ -167,15 +167,17 @@ export default class Bundle {
module.replacements[ '*' ] = namespaceName;
}
const defaultExport = module.exports.default;
if ( module.needsDefault || module.needsAll && module.exports.default ) {
const defaultExport = module.exports.default;
// only create a new name if either
// a) it's an expression (`export default 42`) or
// b) it's a name that is reassigned to (`export var a = 1; a = 2`)
if ( defaultExport.declaredName && !defaultExport.isModified ) return; // TODO encapsulate check for whether we need synthetic default name
// only create a new name if either
// a) it's an expression (`export default 42`) or
// b) it's a name that is reassigned to (`export var a = 1; a = 2`)
if ( defaultExport && defaultExport.declaredName && !defaultExport.isModified ) return; // TODO encapsulate check for whether we need synthetic default name
const defaultName = getSafeName( module.suggestedNames.default );
module.replacements.default = defaultName;
const defaultName = getSafeName( module.suggestedNames.default );
module.replacements.default = defaultName;
}
});
this.orderedModules.forEach( module => {

1
src/Module.js

@ -277,6 +277,7 @@ export default class Module {
const module = importDeclaration.module;
if ( module.isExternal ) return null;
if ( importDeclaration.name === '*' ) return null;
const exportDeclaration = module.exports[ importDeclaration.name ];
return module.findDeclaration( exportDeclaration.localName );

Loading…
Cancel
Save