Skip to content

fix: process render function, exported as default #332 #335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 9, 2021
Merged

fix: process render function, exported as default #332 #335

merged 2 commits into from
May 9, 2021

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