Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Commit

Permalink
Add back support for module.exports objects
Browse files Browse the repository at this point in the history
This was broken in 8a3e99e. Closes #267.
  • Loading branch information
adrianheine committed Dec 26, 2017
1 parent 4ab91c7 commit 7e8a8c4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,6 @@ export function transformCommonjs ( code, id, isEntry, ignoreGlobal, ignoreRequi

wrapperStart = `var ${moduleName} = ${HELPERS_NAME}.createCommonjsModule(function (${args}) {\n`;
wrapperEnd = `\n});`;

Object.keys( namedExports )
.filter( key => !blacklist[ key ] )
.forEach( addExport );
} else {
const names = [];

Expand Down Expand Up @@ -396,6 +392,7 @@ export function transformCommonjs ( code, id, isEntry, ignoreGlobal, ignoreRequi
str: declaration,
name
});
delete namedExports[name];
}

defaultExportPropertyAssignments.push( `${moduleName}.${name} = ${deconflicted};` );
Expand All @@ -409,6 +406,9 @@ export function transformCommonjs ( code, id, isEntry, ignoreGlobal, ignoreRequi
}\n};`;
}
}
Object.keys( namedExports )
.filter( key => !blacklist[ key ] )
.forEach( addExport );

const defaultExport = /__esModule/.test( code ) ?
`export default ${HELPERS_NAME}.unwrapExports(${moduleName});` :
Expand Down

0 comments on commit 7e8a8c4

Please sign in to comment.