Create a vue3 project, command:
1. Use vite to create:
npm create vite@latest my-vue-app -- --template vue-ts
2. Use the official vue command:
npm init vue@latest
Create a vue3 template to learn the new syntax of vue3.3. After the creation is completed, many files are found to be popular:
Reason: The parsing strategy is Bundler
Solution:
1. Created with vite:
Add the following configuration to the tsconfig.json and tsconfig.node.json files:
"compilerOptions": {
......
+ "moduleResolution": "node",
}
After the configuration is complete, it will report red:
Unknown compiler option "allowImportingTsExtensions", used to control whether the .ts file extension is allowed to be imported in the import statement, has been deprecated since TypeScript 3.8.
Solution: delete this option.
2. Use the vue official command to create:
Add the following configuration to the tsconfig.app.json and tsconfig.node.json files:
"compilerOptions": {
......
+ "moduleResolution": "node",
}
Complete the above configuration.
There will be other errors: Cannot find module '@/views/xxx.vue' or its corresponding type declarations can see another article: webstorm vue3+ts error: Cannot find module '@/views/xxx.vue' or its corresponding type declarations_programmer Xiaobai Aven's blog-CSDN blog webstorm vue3+ts error: Cannot find module '@/views/xxx.vue' or its corresponding type declarations https://blog.csdn.net/weixin_52020362/article /details/130665069?spm=1001.2014.3001.5501