nuxt-graphql-server icon indicating copy to clipboard operation
nuxt-graphql-server copied to clipboard

Cannot find module '#graphql/schema' or its corresponding type declarations

Open awdr74100 opened this issue 2 years ago • 5 comments

Many thanks to @tobiasdiez and @sduduzog for their contributions to this module! especially this #68

But there may still be some problems: 螢幕擷取畫面 2023-09-16 012940 螢幕擷取畫面 2023-09-16 013004

#graphql/resolver does not have this problem and can be correctly identified.

Is it possible that vscode cannot correctly identify the path to the .mjs file?

awdr74100 avatar Sep 15 '23 17:09 awdr74100

I'll look into this. I'll create a stackblitz repository to try and reproduce

sduduzog avatar Sep 15 '23 18:09 sduduzog

I can reproduce the issue, but couldn't find a solution yet. Simply correcting the path in nuxt's tsconfig.json doesn't seem to work.

tobiasdiez avatar Sep 16 '23 07:09 tobiasdiez

I've been failing to create a stackblitz repo for this so I haven't been able to do anything.

But this should only affect types and not the functionality?? I'll try again with a fresh project locally tonight

sduduzog avatar Sep 16 '23 12:09 sduduzog

As a work around @awdr74100

Please create a declaration file anywhere in your project, e.g. temp.d.ts

and add the following

declare module '#graphql/schema' {
  export const schema: string
}

sduduzog avatar Sep 16 '23 12:09 sduduzog

@sduduzog thank you for your help!

awdr74100 avatar Sep 19 '23 09:09 awdr74100