preface

Recently, I am working on an open source project. After the project is completed, I will open source. The technology stack uses Vue 3+ Vite + TS. Starting from scratch, this article will serve as a record of problems encountered during the project. Encounter similar problem later can do a quick check.

Initialize the project

Reference: Vite official website

Use NPM:

$ npm init vite@latest
Copy the code

Using Yarn:

$ yarn create vite
Copy the code

Use the PNPM:

$ pnpm create vite
Copy the code

The problem record

Module ‘ ‘xx.vue’ ‘has no default export.Vetur(1192)

After initializing the project, open helloWorld.vue in the project and find the following error

Although it does not affect the normal operation of the project, it is very uncomfortable to see the error.

Specific error message:

Module '"somepath/HelloWorld.vue"' has no default export.Vetur(1192)
Copy the code

You can see that the error message is from Vetur. Vetur’s Issue refers to:

If you look at recent changes made to vitepress, Evan seems to suggest the team to use Volar instead of Vetur for now, so maybe you can try using that until Vetur is up-to-date.

Then use the official recommended VSCode plug-in Volar, restart the problem solved.

Solution:

  • useVolarPlug-in replacementVetur