Skip to content

Commit

Permalink
Merge pull request #81 from mizdra/improve-example-config
Browse files Browse the repository at this point in the history
Update example config
  • Loading branch information
mizdra authored Apr 17, 2024
2 parents edaf389 + ccb3b58 commit eb7f2bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ const config: CodegenConfig = {
config: {
enumsAsTypes: true, // required
avoidOptionals: true, // required
// skipIsAbstractType: false, // If you use Relay, you should set this option to `false`
},
},
'./__generated__/fabbrica.ts': {
plugins: ['@mizdra/graphql-codegen-typescript-fabbrica'],
config: {
typesFile: './types', // required
// typesFile: './types.js' // If you use factories from Node.js and set `package.json#type` to `module`, you should add `.js` extension
// typesFile: './types.js' // If you use factories from Node.js and set `--moduleResolution` of `tsconfig.json` to `Node16` or `NodeNext`, you should add `.js` extension
},
},
},
Expand Down Expand Up @@ -397,7 +398,7 @@ type: `string`, required

Defines the file path containing all GraphQL types. This file can be generated with the [typescript plugin](https://the-guild.dev/graphql/codegen/plugins/typescript/typescript).

If you use factories on Node.js and set `package.json#type` to `module`, you should add `.js` extension to the file path. If you use factories on other runtimes, you should not add `.js` extension.
If you use factories on Node.js and set `--moduleResolution` of `tsconfig.json` to `Node16` or `NodeNext`, you should add `.js` extension to the file path. If you use factories on other runtimes, you should not add `.js` extension.

```ts
import { CodegenConfig } from '@graphql-codegen/cli';
Expand All @@ -414,7 +415,7 @@ const config: CodegenConfig = {
plugins: ['@mizdra/graphql-codegen-typescript-fabbrica'],
config: {
typesFile: './types', // required
// typesFile: './types.js' // If you use factories from Node.js and set `package.json#type` to `module`, you should add `.js` extension
// typesFile: './types.js' // If you use factories from Node.js and set `--moduleResolution` of `tsconfig.json` to `Node16` or `NodeNext`, you should add `.js` extension
},
},
},
Expand Down

0 comments on commit eb7f2bc

Please sign in to comment.