Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 BUG: astro-vscode extension .astro file(component) import error. #781

Closed
CodeVxDev opened this issue Feb 10, 2024 · 1 comment
Closed
Labels
needs triage Issue needs to be triaged

Comments

@CodeVxDev
Copy link

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.

image

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

  1. Upgrade Astro vscode extension to version 2.7.0 or above.
  2. 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"],
}
  1. Import any .astro component into the index.astro or any other component.
  2. Error! "Cannot find module '@/components/<component-name>' or its corresponding type declarations."
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Feb 10, 2024
@Princesseuh
Copy link
Member

Duplicate of #778

@Princesseuh Princesseuh marked this as a duplicate of #778 Feb 10, 2024
@Princesseuh Princesseuh closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants