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