Home > OS >  Vue | Module has no default export
Vue | Module has no default export

Time:08-28

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>

CodePudding user response:

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>

CodePudding user response:

You must add export default in your component's script by example:

<script>
export default {
  name: "HelpView",
};
</script>
  • Related