I encountered an error in vue3, ts, vue cli, which shows
Module '"c:/Users/USER/Documents/top-secret-project/src/components/Features/Features.vue"' has no default export.
When importing components from a file
I don't know why this particular component decided to work now.
This is Features.vue
<script lang="ts"> import Feature from "./Feature.vue"; </script> <template> <Feature /> </template>
@Boussadjra mentioned that this may happen if the Vetur extension is installed in Visual Studio Code. Insert
Vetur
This problem can be solved if we install theVolar
extension in Visual Studio Code.Use script setup syntax, no need to add
export default
in the script, just add thesetup
attribute to the script: