Graphql-code-generator: Add option to `typescript-graphql-files-modules` to generate complete paths

Created on 15 Nov 2019  路  5Comments  路  Source: dotansimha/graphql-code-generator

Currently the modules generated for the files have a wildcard as path. Example: declare module '*/Project.gql' {

I would like an option to generate the files with the absolute path (src/graphql/queries/Project.gql). This way auto-imports will work correctly in VS Code

enhancement plugins waiting-for-release

Most helpful comment

@tyankatsu0105 For me it works using something like:

generates:
  src/types/graphql.d.ts:
    plugins:
      - 'typescript-graphql-files-modules'

    config:
      relativeToCwd: true

All 5 comments

I implemented it in this PR: https://github.com/dotansimha/graphql-code-generator/pull/3010

With these changed, you should be able to set now relativeToCwd: true to generate a complete path to CWD, and you can customize the prefix (default for */).

@pietdevries94

Available in 1.9.0

@dotansimha
How can I set the option for typescript-files-modules?

@tyankatsu0105 For me it works using something like:

generates:
  src/types/graphql.d.ts:
    plugins:
      - 'typescript-graphql-files-modules'

    config:
      relativeToCwd: true

Would be awesome if these would generate files in-place, so that I'd get a .d.ts file for each document

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SimenB picture SimenB  路  3Comments

RIP21 picture RIP21  路  3Comments

edorivai picture edorivai  路  3Comments

steebchen picture steebchen  路  3Comments

fvisticot picture fvisticot  路  3Comments