Skip to content

Conversation

@0x009922
Copy link
Contributor

@0x009922 0x009922 commented May 6, 2021

I just commented out line node.add(';exports.default = {...exports.default};'), added simple test, and everything just works.
Perhaps, in some edge cases, you will still need to copy exports.default into yourself. Then you can try this option:

node.add(`;
  if (typeof exports.default === 'function') {
    const fn = exports.default;
    exports.default = (...args) => fn(...args);
    Object.assign(exports.default, fn)
  } else {
    exports.default = {...exports.default};
  }
`)

@lmiller1990
Copy link
Member

Empty else block is a little weird - we can probably remove it. Anyway, Ci is green so I guess this is fine! Thanks.

@lmiller1990 lmiller1990 merged commit 9cd1062 into vuejs:next May 9, 2021
@0x009922 0x009922 deleted the next branch May 10, 2021 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants