Skip to content

Commit

Permalink
fix export of __moduleExports as undefined (caused by newest NODE ES6…
Browse files Browse the repository at this point in the history
… system?)
  • Loading branch information
FbN committed Mar 14, 2020
1 parent bf94a85 commit 829219e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/commonjs/src/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,12 @@ export function transformCommonjs(
function addExport(x) {
const deconflicted = deconflict(scope, globals, name);

const path = x === '__moduleExports' ? moduleName : `${moduleName}.${x}`;

This comment has been minimized.

Copy link
@lukastaegert

lukastaegert Mar 16, 2020

Looks sensible to me and fits the issue. path is maybe a little confusing name as it is not referring to file paths here, maybe something like exportedExpression.


const declaration =
deconflicted === name
? `export var ${x} = ${moduleName}.${x};`
: `var ${deconflicted} = ${moduleName}.${x};\nexport { ${deconflicted} as ${x} };`;
? `export var ${x} = ${path};`
: `var ${deconflicted} = ${path};\nexport { ${deconflicted} as ${x} };`;

namedExportDeclarations.push({
str: declaration,
Expand Down

0 comments on commit 829219e

Please sign in to comment.