Error TS1258: A default export must be at the top of a file or module declaration


I used Vite to create a vue-typescript build but I’m getting an error and I can’t figure out what the problem is. Can you please help me with the meaning of the error?

Hola!! tengo el mismo error, has podido solucionarlo?

@LauraOrte si estas usando ‘setup’ en tu script tag no hace falta que uses export default :call_me_hand:

But this is what the Reactivity Fundamentals section of the Docs recommends.

The problem is that your <script> has the word setup in it. Replace with

<script lang="ts">

This is probably because you use export default defineComponent in script setup, where it is not needed. I got the same error as you when I tried to do it, but in only in VSCode for some reason.
Try to simplify it like this:

<script setup lang="ts">
import NavBar from './components/NavBar.vue'


no more code in script tag should be needed.