Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm facing an error with vue3, ts, vue cli where it says Module '"c:/Users/USER/Documents/top-secret-project/src/components/Features/Features.vue"' has no default export. when importing a component from a file I have no idea why did this specific component decide to now work.

here's Features.vue

<script lang="ts">
import Feature from "./Feature.vue";
</script>
<template>
  <Feature />
</template>
                @BoussadjraBrahim, it's just a div with script setup and inside it is an import of a component
– Termin
                Aug 27, 2022 at 17:16

A @Boussadjra mentioned this could happen in Visual Studio Code if Vetur extension is installed there. Insetted of Vetur if we install Volar extension in Visual Studio Code this problem gets solved.

This issue is addressed in the vue 3 documentation, vuejs.org/guide/typescript/overview.html#volar-takeover-mode. – Gabriel Suttner Jul 2 at 2:34

With script setup syntax there's no need to add export default in your script, just add the setup attribute to your script:

<script lang="ts" setup>
import Feature from "./Feature.vue";
</script>
<template>
  <Feature />
</template>
                I'm using Vue 3 with vite and I'm thinking something is wrong with Vetur, because my code has setup as you said and it keep saying no export default in module
– Shad
                Dec 26, 2022 at 14:19
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.