Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ckaeslin committed Oct 4, 2016
1 parent 14130a7 commit 2687b54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default function transform ( code, id, isEntry, ignoreGlobal, customNamed

// we're dealing with `module.exports = ...` or `[module.]exports.foo = ...` –
// if this isn't top-level, we'll need to wrap the module
if ( programDepth > 3 ) shouldWrap = true;
if ( programDepth > 3 || /^Function/.test( node.right.type )) shouldWrap = true;

node.left._skip = true;

Expand Down
6 changes: 5 additions & 1 deletion test/form/optimised-default-export-function/output.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
var input = function foo () {};
import * as commonjsHelpers from 'commonjsHelpers';

var input = commonjsHelpers.createCommonjsModule(function (module) {
module.exports = function foo () {};
});

export default input;
export { input as __moduleExports };

0 comments on commit 2687b54

Please sign in to comment.