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>
P粉1285631402023-10-27 07:17:28
@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 the Volar
extension in Visual Studio Code.
P粉6656790532023-10-27 00:29:07
Use script setup syntax, no need to add export default
in the script, just add the setup
attribute to the script:
<script lang="ts" setup> import Feature from "./Feature.vue"; </script> <template> <Feature /> </template>