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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript error in multi-repo setup #8616

Closed
1 task
silveltman opened this issue Sep 21, 2023 · 2 comments
Closed
1 task

Typescript error in multi-repo setup #8616

silveltman opened this issue Sep 21, 2023 · 2 comments
Labels
needs triage Issue needs to be triaged

Comments

@silveltman
Copy link

silveltman commented Sep 21, 2023

Astro Info

Astro                    v3.1.1
Node                     v18.17.1
System                   macOS (arm64)
Package Manager          yarn
Output                   server
Adapter                  @astrojs/cloudflare
Integrations             @astrojs/svelte
                         @astrojs/sitemap
                         @astrojs/prefetch
                         astro-robots-txt
                         unocss:config
                         unocss:transformers:default
                         unocss:transformers:pre
                         unocss:transformers:post
                         unocss:devtools
                         unocss:api
                         unocss:inspector
                         unocss:global:build:scan
                         unocss:global:content
                         unocss:global:build:generate
                         unocss:global:build:bundle
                         unocss:global
                         unocss:global:post

If this issue only occurs in one browser, which browser is a problem?

vscode

Describe the Bug

The following typescript error when importing svelte components into astro files:

File '.../astro/src/components/MyComponent.svelte.tsx' is not a module.

Is the `@astrojs/svelte` package installed? You can add it to your project by running the following command: `astro add svelte`. If already installed, restarting the language server might be necessary in order for the change to take effect.ts(230

I'm using a multi-repo setup where I have the root, and within this root are 2 folder, of which one is 'astro'. When opening the astro folder itself, the errors disappear.

When using yarn workspaces the problem disappeard, but I need the node_modules to be installed in the astro folder itself

What's the expected result?

Typescript to recognize the fact that @astrojs/svelte is installed.

Link to Minimal Reproducible Example

Can't because its a vscode error

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Sep 21, 2023
@TClark1011
Copy link

I'm getting the same thing in my project and it is not a multi repo project. Its occurring in the /src/pages/homebrew/[slug].astro file when trying to import $/components/SlideOutPanel.svelte, I am using the paths field in tsconfig for that aliasing, and the error still occurred for me even if I switched to a regular relative path import. I am using bun as the package manager, but I have tried to switching to yarn and the error did not go away.

@bluwy
Copy link
Member

bluwy commented Sep 22, 2023

Duplicate of withastro/language-tools#652

@bluwy bluwy marked this as a duplicate of withastro/language-tools#652 Sep 22, 2023
@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Sep 22, 2023
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

3 participants