New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Renaming .vue files breaks resolving import paths #1125
Labels
bug
Something isn't working
Comments
johnsoncodehk
added a commit
that referenced
this issue
Apr 10, 2022
maybe problem still exist |
Also experiencing this +1 |
Also experiencing this +1 @johnsoncodehk |
这个问题有修复计划么,或者对应的缓存文件夹在哪个位置,让我们临时手动清一下对应的缓存也行。 |
Just experienced the same issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to reproduce issue:
Create new file called "Test.vue":

Rename to "test.vue":

The error:
Cannot find module '@/models/user.model' or its corresponding type declarations.ts(2307)
I also reproduced this by creating a file called "default.vue" that worked no problem with the imports, and after renaming it to "Default.vue" it stopped working. It's as if it is impossible to rename files.
I tried restarting the volar server, deleteing the ".vscode" directory and nothing helped.
In the tsconfig.json and in vite.conte.ts I have correctly configured the mapping for the paths.
I am able to build and run the app with no issues despite the errors shown in the vscode which leads me to believe the issue is with Volar.
tsconfig:
{ "compilerOptions": { "target": "es6", "module": "esnext", "strict": true, "importHelpers": true, "moduleResolution": "node", "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "allowJs": true, "noImplicitAny": false, "strictNullChecks": false, "sourceMap": true, "baseUrl": ".", "paths": { "@/*": ["./src/*"], "~shared/*": ["../backend/src/core/models/*"] }, "types": ["vite/client", "vuetify"], "lib": ["esnext", "dom", "dom.iterable", "scripthost"], "suppressImplicitAnyIndexErrors": true, "rootDirs": ["./src"] }, "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"], "exclude": ["node_modules"] }
vite.config.ts (showing only the relevant part:
I tried this:
alias: { '@': fileURLToPath(new URL("./src", import.meta.url)) }
and also this:
alias: { '@': resolve(__dirname, 'src') }
Both work but not when changing file names.
I also tried deleting the file and creating it again and still it somehow remembers the old name and won't autocomplete the paths unless the filename is as it was initially.
The text was updated successfully, but these errors were encountered: