How to solve the problem that the component cannot be found in vue3.0 or the corresponding type declaration cannot be found?
- Here is the error, the reason for the error
- Error reporting is the impact of ts
- The component module could not be found or the corresponding type declaration could not be found
- Typescript can only understand .ts files, not .vue files
- Solution
Create a file with the suffix .d.ts in the project root directory or src folder, and write the following content: -
declare module '*.vue' { import { ComponentOptions } from 'vue' const componentOptions: ComponentOptions export default componentOptions }
- Of course the name is arbitrary
- Many people think that saving is enough => just restarting the project
requires ctrl+c to terminate the project and restart the project