Components dont have default export with multiple <script>
Version
3.2.4
Reproduction link
https://github.com/Nisgrak/test-setup-ts
Steps to reproduce
- Init the proyect with
yarn serve
- See the error that happen with HelloWorld components
What is expected?
Can export interfaces and other vars in a normal <script>
tag having an <script setup>
one
What is actually happening?
An error with the default export of the HelloWorld component
I try to create a interface of the props of a components and export it, using the new <script setup>
, but it don't work and in the docs it says if have to export something must be in a normal <script>
Maybe a duplicate of https://github.com/vuejs/vue-next/issues/4294 as it seems that you can import what is exported in other files
It give another error, I create a branch for the example, moving the export in the <script setup>
tag
It seems if I add this to the bottom of the <script>
tag works, but cant use the interface to declare the prosp inside <script setup>
, it's need to exist inside the setup, but there can't be exported, strange...
export default defineComponent({});
I created the branch workaround
in the repo with this fix If you need to test it, thanks!
I'm still having this issue in 3.2.9. I've been using the workaround Nisgrak and if I remove it in 3.2.9 the errors about SFCs not having a default export come back.
@edison1105 I did update both dependencies, actually.
If Nisgrak's repo no longer reproduces the issue I can attempt to make another one later today
@henribru
yes, It still has the issue.
It's my fault. My PR has not fixed this issue but improve the defineProps
.
I misunderstood it. This is about using the exported interface in another file.
the error info is changed.
works fine in playground, it's not a vue core bug.
It works fine in vite project, or ignores the type check can also work normally.
// @ts-ignore
import HelloWorld, { HelloWorldProps } from './components/HelloWorld.vue';