Open ldrick opened 1 year ago
@graphql-codegen/typescript-graphql-request
If you try to generate a ESM compatible sdk with @graphql-codegen/typescript-graphql-request it imports gql namespace, instead of {gql} function
gql
{gql}
https://the-guild.dev/graphql/codegen
generates: sdk.ts: plugins: - typescript - typescript-graphql-request config: emitLegacyCommonJSImports: false
import gql from 'graphql-tag';
should output
import {gql} from 'graphql-tag';
No response
graphql
Workaround:
// gql-fix.ts import { gql } from "graphql-tag"; export { gql };
and use it like:
generates: sdk.ts: plugins: - typescript - typescript-graphql-request config: emitLegacyCommonJSImports: false gqlImport: ./gql-fix.js#gql,
Another workaround is:
generates: sdk.ts: plugins: - typescript - typescript-graphql-request config: emitLegacyCommonJSImports: false gqlImport: graphql-tag#gql,
Which packages are impacted by your issue?
@graphql-codegen/typescript-graphql-request
Describe the bug
If you try to generate a ESM compatible sdk with
@graphql-codegen/typescript-graphql-request
it importsgql
namespace, instead of{gql}
functionYour Example Website or App
https://the-guild.dev/graphql/codegen
Steps to Reproduce the Bug or Issue
Expected behavior
should output
Screenshots or Videos
No response
Platform
graphql
version: 16.6.0@graphql-codegen/typescript-graphql-request
version: 4.5.9Codegen Config File
No response
Additional context
Workaround:
and use it like: