graphql-code-generator-community icon indicating copy to clipboard operation
graphql-code-generator-community copied to clipboard

typescript-react-query custom fetcher not using correct import with near-operation-file

Open dohomi opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

Using near-oparation-file has a wrong import using custom fetcher.

Describe the solution you'd like

The path should be correct.

Describe alternatives you've considered

Using typescript alias path fixes it but might be an easier fix within the plugin

dohomi avatar Aug 29 '24 02:08 dohomi

    generates: {
        "./src/utils/__generated__/types.ts": {
            documents: ['src/**/*.gql'],
            plugins: ["typescript", "typescript-operations"],
            config: {
                dedupeFragments: true,
             }
        },
        "src/": {
            preset: "near-operation-file",
            documents: ['src/**/*.gql'],
            plugins: ["typescript-react-query"],
            config: {
                fetcher: {
                    func: "@gql-fetcher#fetchData", // this is always a fixed path and not a relative path
                    isReactHook: false
                },
                reactQueryVersion: 5,
                dedupeFragments: true,
                importOperationTypesFrom: "Types",
            }
        }
    }

dohomi avatar Aug 29 '24 02:08 dohomi