Skip to content

Commit

Permalink
Add fix || introduce a bug || both
Browse files Browse the repository at this point in the history
Point of order: I have no idea what specifier.local is or does. I just
noticed that named wildcard exports don't have specifier.local.name,
but it does have specifier.exported.name. HTH?
  • Loading branch information
spncrlkt committed Feb 12, 2016
1 parent 6c0bd15 commit ca03f70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion fixtures/transformation/namedWildcardExport/expected.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * as namedThing from 'path/to/thing';
import * as _namedThing from 'path/to/thing';
export { _namedThing as namedThing };
3 changes: 2 additions & 1 deletion src/babel-plugin-rewire.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ module.exports = function({ types: t }) {

'ExportNamedDeclaration|ExportAllDeclaration': function ({ node: { specifiers = [] } }, rewireInformation) {
let hasDefaultExport = specifiers.some(function(specifier) {
return specifier.local.name === 'default';
return ((specifier.local && specifier.local.name === 'default') ||
(specifier.exported && specifier.exported.name === 'default'));
});
rewireInformation.hasES6DefaultExport = rewireInformation.hasES6DefaultExport || hasDefaultExport;
rewireInformation.isES6Module = true;
Expand Down

0 comments on commit ca03f70

Please sign in to comment.