Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

[v1][client] Typed client fails to resolve imports with typescript aliases used in queries #289

Open
madeleineostoja opened this issue Feb 16, 2023 · 0 comments

Comments

@madeleineostoja
Copy link

madeleineostoja commented Feb 16, 2023

I have snippets that I reuse in my queries, which I import from a file. That file import is aliased, configured both in Typescript and Vite (used in a Sveltekit app), but the client tries to resolve these imports and fails.

Eg:

import { groq, sanity } from '$src/lib/sanity';
import { asset } from '$src/lib/fragments';

sanity('Foo', groq`
  * {
   image {
     ${asset}
   }
`)

Resulting error:

 [default] Generating types for workspace `default`    Error: Cannot find module '$src/lib/fragments'

Rewriting the asset snippet import to not use an alias fixes the error, but is an annoying workaround


EDIT: This is kinda redundant if this issue can't be resolved: #290

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant