Skip to content
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

Vue SFC: Duplicate export of 'default' #595

Closed
ChrisShank opened this issue Jul 21, 2020 · 2 comments · Fixed by #599
Closed

Vue SFC: Duplicate export of 'default' #595

ChrisShank opened this issue Jul 21, 2020 · 2 comments · Fixed by #599

Comments

@ChrisShank
Copy link
Contributor

Describe the bug

When the default export of a Vue SFC is written as export { HelloWorld as default } the following error occurs: Uncaught SyntaxError: Duplicate export of 'default'. I think that a fix might be related to commit 59938bc.

Reproduction

Let me know if you need a reproducer...

System Info

  • required vite version: v1.0.0-rc.3
  • required Operating System: Windows 10
  • required Node version: v14.4.0
  • Optional:
    • npm/yarn version: yarn v1.22.4
    • Installed vue version (from yarn.lock or package-lock.json): 3.0.0-rc.4
    • Installed @vue/compiler-sfc version: 3.0.0-rc.4

Logs (Optional if provided reproduction)

This is the output of the rewrite of components/HelloWorld.vue

const HelloWorld = {
  name: 'HelloWorld',
  props: {
    msg: String
  },
  data() {
    return {
      count: 0
    }
  }
}

export { HelloWorld as default }

import { render as __render } from "/src/components/HelloWorld.vue?type=template"
__script.render = __render
__script.__hmrId = "/src/components/HelloWorld.vue"
__script.__file = "<local path to file>"
export default __script
@ChrisShank
Copy link
Contributor Author

Thanks for the fix @underfin! ❤️ I was also experiencing the same edge case in your vite-plugin-vue2 if you have a chance to look into it!

@underfin
Copy link
Member

Yeah.I will fix it.

yyx990803 pushed a commit that referenced this issue Jul 29, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants