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

🐛 BUG: Vue types imported from monorepo package are not regonized #674

Open
minht11 opened this issue Oct 29, 2023 · 8 comments
Open
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: vue Related to the Vue integration (scope)

Comments

@minht11
Copy link

minht11 commented Oct 29, 2023

Describe the Bug

I have monorepo, with two packages one is vue components and other regular astro site. I use project references and so on. Importing regular ts/tsx files inside astro pages work as expected, but when I try importing any of my vue components, types are not resolved correctly. If i reexport vue components to index.ts and then import that, it shows that such export exists but types are empty. Actual vue component runs, just types are wrong.

Semi related to #649 but I don't do any bundling/dts emit so it is bit different.

Steps to Reproduce

  1. Setup monorepo with 2 packages. One vue components, other regular astro site.
  2. Try to import component from vue package, into astro site.
  3. Observe types being not recognized.
@Princesseuh
Copy link
Member

Any chance you could share a reproduction?

@Princesseuh Princesseuh added needs repro Issue needs a reproduction feat: vue Related to the Vue integration (scope) labels Oct 29, 2023
@minht11
Copy link
Author

minht11 commented Oct 29, 2023

You should be able reproduce issue here https://github.com/minht11/astro-monorepo-types-issue

@Princesseuh Princesseuh removed the needs repro Issue needs a reproduction label Oct 29, 2023
@minht11
Copy link
Author

minht11 commented Nov 5, 2023

I installed volar extension to see virtual files for vue components in design-system package and they are empty, because of this line

const integrationEditorEntrypoint =
framework === 'vue' ? importVueIntegration(filePath) : importSvelteIntegration(filePath);
if (!integrationEditorEntrypoint) {
const EMPTY_FILE = '';
return getVirtualFile(EMPTY_FILE);
}

As far as I understand astro resolves entry point for design-system not for site package, it doesn't find @astro/vue integration installed there so it returns empty file.

In fact if I add "@astrojs/vue": "^3.0.1" to design-system package.json it starts to work.

@Princesseuh Princesseuh added the - P3: minor bug An edge case that only affects very specific usage (priority) label Nov 12, 2023
@codethief
Copy link

codethief commented Jul 25, 2024

@Princesseuh Just found my way here through Google. Could you comment on the state of support for TSC project references in astro check? I have been trying to get Astro to correctly type-check .astro files which import files from other projects but it either complains about those files not existing (if I use astro check --tsconfig tsconfig.astro.json) or it ignores those imports entirely & fails to recognize type errors (if I use astro check --tsconfig tsconfig.json, where tsconfig.json is the "main" aka "solution-style" tsconfig that references everything else). I'll be happy to file a bug report but first I wanted to check what to expect and whether I'd need to create minimal example at all that reproduces my issues. (For instance, the people over at moonrepo also report that astro check does not work with project references.)

On a more general note, it'd be great if the docs went into a bit more detail on what astro check & the language server it uses actually do. (Do they use TSC under the hood? What TSC features are supported? etc.)

@Princesseuh
Copy link
Member

Princesseuh commented Jul 25, 2024

I don't know exactly the features that are supported, astro check is a pretty thin wrapper around @volarjs/kit, which uses the TypeScript APIs directly to get errors (this is similar to vue-tsc works, if you're familiar with that)

@codethief
Copy link

I see, thank you! The thing is that vue-tsc works well with project references, so now I'm surprised that astro check behaves differently. :\

@codethief
Copy link

If I file a bug report, I suppose I should file it here in this repo then?

@Princesseuh
Copy link
Member

If I file a bug report, I suppose I should file it here in this repo then?

I think the issue is ultimately upstream, but you may fill it here for convenience and I'll report it upstream (either way, I'm a maintainer of both projects so...)

vue-tsc only somewhat works like this, it uses fairly different codepaths mostly because it does other things

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: vue Related to the Vue integration (scope)
Projects
None yet
Development

No branches or pull requests

3 participants