graphprotocol / graph-client

The Graph library for building GraphQL-based dapps in a decentralized way.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recommended way of distributing SDK ?

kyriediculous opened this issue · comments

Hi,

I'm trying to build the generated SDK as a separate package (in the future also adding resolvers, etc).

What is the recommended way of building and distributing the generated SDK ?

I've tried a few things so far but I'm hitting a couple of roadblocks.

E.g. when having "type": "module" in my package.json file and running graphclient build I get introspection errors when generating the schema Failed to generate the schema Error: Failed to fetch introspection from xxxxx: TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts"

If I remove "type": "module" I can build the graphclient and compile the typescript, but when I then try to use the package in a separete codebase I get Module not found: Can't resolve '@graphql-mesh/utils' at runtime.

If I build as CJS using graphclient build --fileType js and import that in my other repo, I also get Can't resolve '@graphql-mesh/utils'

Any advice is much appreciated !