[Vue3 Vite Setting] How to set root file in each component file correctly?
I create component root file named “index.vue” in my “frontView” file folder. Webstorm has the correct path recognition, so the file can be found by command + click in import path line. But in file, Webstorm still show “Vue: Cannot find module @/views/front/frontView or its corresponding type declarations.” with red underline. How to set up correctly for path recognition ?
- views
- frontView
- index.vue
请先登录再写评论。
Looks like the language server is confused by your setup, it expects either
index.ts
orfrontView.{ts,vue}
here. Does your application compile? Could you share a sample project that demonstrates your setup?Hi,
This is the sample project. You can download from my Google Drive : https://drive.google.com/file/d/1_8mJ7g22NZZ9aHMVP-PK-d5XxtXjvGt5/view
My question is in : src > router > index.ts file
My application doesn't compile.
Why is my latest post pending approval ?
Thank you for the project!
I can see the same issue when I open it in VSCode:
vue-tsc
also reports the issue:So it looks like the Volar limitation. Please see comments in https://github.com/vuejs/language-tools/issues/2724
Thank you for the solution ! It works for me.
I add moduleSuffixes in tsconfig.json and solved the issue.