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

Multiple exports with the same name "default" #6692

Closed
7 tasks done
jacekkarczmarczyk opened this issue Jan 31, 2022 · 2 comments
Closed
7 tasks done

Multiple exports with the same name "default" #6692

jacekkarczmarczyk opened this issue Jan 31, 2022 · 2 comments

Comments

@jacekkarczmarczyk
Copy link

jacekkarczmarczyk commented Jan 31, 2022

Describe the bug

Following code doesn't work with vite, it's a valid js/ts syntax and it works fine in vue cli

<script lang="ts">
export { default } from './Foo.vue';
</script>

Workaround 1:

<script lang="ts">
import Foo from './Foo.vue';

export default Foo;
</script>

Workaround 2 (plain ts file):

export { default } from './Foo.vue';

Reproduction

https://github.com/jacekkarczmarczyk/vite-exports-issue

Run yarn dev or yarn build

System Info

System:
    OS: Windows 10 10.0.19043
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 5.54 GB / 15.87 GB
  Binaries:
    Node: 16.11.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.0.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 97.0.4692.71
    Edge: Spartan (44.19041.1266.0), Chromium (97.0.1072.76)
    Internet Explorer: 11.0.19041.1202
  npmPackages:
    @vitejs/plugin-vue: ^2.0.0 => 2.1.0
    vite: ^2.7.2 => 2.7.13

Used Package Manager

yarn

Logs

09:06:18 [vite] Internal server error: Transform failed with 1 error:
C:/cygwin64/home/PC/jacekkarczmarczyk/issues/my-vue-app/src/components/NotWorking.vue:18:7: error: Multiple exports with the same name "default"
  Plugin: vite:vue
  File: C:/cygwin64/home/PC/jacekkarczmarczyk/issues/my-vue-app/src/components/NotWorking.vue

  Multiple exports with the same name "default"
  16 |  })
  17 |  import _export_sfc from 'plugin-vue:export-helper'
  18 |  export default /*#__PURE__*/_export_sfc(_sfc_main, [['__file',"C:/cygwin64/home/PC/jacekkarczmarczyk/issues/my-vue-app/src/components/NotWorking.vue"]])
     |         ^

      at failureErrorWithLog (C:\cygwin64\home\PC\jacekkarczmarczyk\issues\my-vue-app\node_modules\esbuild\lib\main.js:1493:15)
      at C:\cygwin64\home\PC\jacekkarczmarczyk\issues\my-vue-app\node_modules\esbuild\lib\main.js:1282:29
      at C:\cygwin64\home\PC\jacekkarczmarczyk\issues\my-vue-app\node_modules\esbuild\lib\main.js:629:9
      at handleIncomingPacket (C:\cygwin64\home\PC\jacekkarczmarczyk\issues\my-vue-app\node_modules\esbuild\lib\main.js:726:9)
      at Socket.readFromStdout (C:\cygwin64\home\PC\jacekkarczmarczyk\issues\my-vue-app\node_modules\esbuild\lib\main.js:596:7)
      at Socket.emit (node:events:390:28)
      at addChunk (node:internal/streams/readable:315:12)
      at readableAddChunk (node:internal/streams/readable:289:9)
      at Socket.Readable.push (node:internal/streams/readable:228:10)
      at Pipe.onStreamRead (node:internal/stream_base_commons:199:23)

Validations

@jacekkarczmarczyk
Copy link
Author

@patak-dev @OliverTsang does #6851 fixes this issue?

I don't have any errors when building with 2.9.0-beta.10 (or even in 2.8.latest), but maybe there is some other problem with this that I'm not aware of?

@bluwy
Copy link
Member

bluwy commented Mar 30, 2022

Yeah looks like this was indeed fixed. Thanks for checking this again @jacekkarczmarczyk! I'll close this then.

@bluwy bluwy closed this as completed Mar 30, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants