diff --git a/src/Module.js b/src/Module.js index 876fec0..e5c38a0 100644 --- a/src/Module.js +++ b/src/Module.js @@ -358,6 +358,7 @@ export default class Module { return { strongDependencies, weakDependencies }; } + // TODO this seems superfluous defaultName () { const defaultExport = this.exports.default; diff --git a/src/finalisers/shared/getExportBlock.js b/src/finalisers/shared/getExportBlock.js index 891fb0a..e475a6f 100644 --- a/src/finalisers/shared/getExportBlock.js +++ b/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' );