#[Resolved] Trying to use graphql-codegen but none of the options seem to work

1 messages · Page 1 of 1 (latest)

native slate
#

I have been trying to use graphql-codegen to generate types for GQL schema.

I've tried the following with a bit different errors:

$ deno run --allow-read --allow-env --allow-sys --allow-write --unstable npm:@graphql-codegen/[email protected]/gql-gen                   
Cannot destructure property 'Buffer' of 'globalThis' as it is undefined.
$ deno run --allow-read --allow-env --allow-sys --allow-write --unstable https://esm.sh/@graphql-codegen/[email protected]
error: Uncaught SyntaxError: The requested module '/v111/[email protected]/deno/graphql.js' does not provide an export named 'GraphQLError'
    at <anonymous> (https://esm.sh/v111/@graphql-tools/[email protected]/deno/utils.js:2:1183)
$ deno run --allow-read --allow-env --allow-sys --allow-write --allow-net --unstable https://cdn.skypack.dev/@graphql-codegen/[email protected]
Warning Implicitly using latest version (0.180.0) for https://deno.land/std/node/crypto.ts
Warning Implicitly using latest version (0.180.0) for https://deno.land/std/node/module.ts
Warning Implicitly using latest version (0.180.0) for https://deno.land/std/node/os.ts
Warning Implicitly using latest version (0.180.0) for https://deno.land/std/node/child_process.ts
Warning Implicitly using latest version (0.180.0) for https://deno.land/std/node/fs.ts
Warning Implicitly using latest version (0.180.0) for https://deno.land/std/node/string_decoder.ts
Warning Implicitly using latest version (0.180.0) for https://deno.land/std/node/path.ts
Warning Implicitly using latest version (0.180.0) for https://deno.land/std/node/tty.ts
error: Module not found "https://deno.land/std/node/crypto.ts".
    at https://cdn.skypack.dev/-/@graphql-codegen/[email protected]/dist=es2019,mode=imports/optimized/@graphql-codegen/cli.js:1:26

Ideas would be welcome since now I have to put unknown or any in many places in the code.

native slate
#

Turned out that esm.sh site has a bug in code generation and can generate broken deno packages.