๐ BUG: astro-vscode extension .astro file(component) import error.
Closed this issue ยท 1 comments
CodeVxDev commented
Describe the Bug
The Astro vscode extension version 2.7.0 and above gives an error stating "Cannot find module '@/components/<component-name>' or its corresponding type declarations." while importing components.
tsconfig:
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"strictNullChecks": true,
"baseUrl": ".",
"verbatimModuleSyntax": true,
"paths": {
"@/components/*": ["src/components/*.astro"],
"@/layouts/*": ["src/layouts/*.astro"],
"@/utils": ["src/utils/index.ts"],
"@/data/*": ["src/data/*"],
"@/site-config": ["src/data/site.config.ts"],
"@/styles": ["src/styles/"],
},
},
"exclude": ["node_modules", "**/node_modules/*", ".vscode", "dist"],
}
It was working fine until version 2.6.3.
Steps to Reproduce
- Upgrade Astro vscode extension to version 2.7.0 or above.
- Add a tsconfig.json file with the below configurations.
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"strictNullChecks": true,
"baseUrl": ".",
"verbatimModuleSyntax": true,
"paths": {
"@/components/*": ["src/components/*.astro"],
"@/layouts/*": ["src/layouts/*.astro"],
"@/utils": ["src/utils/index.ts"],
"@/data/*": ["src/data/*"],
"@/site-config": ["src/data/site.config.ts"],
"@/styles": ["src/styles/"],
},
},
"exclude": ["node_modules", "**/node_modules/*", ".vscode", "dist", ".husky", ".astro"],
}
- Import any .astro component into the index.astro or any other component.
- Error! "Cannot find module '@/components/<component-name>' or its corresponding type declarations."
Princesseuh commented
Duplicate of #778