graphql-code-generator
graphql-code-generator copied to clipboard
near-operation-file + typescript-react-apollo = Failed to resolve .js import
Describe the bug
I still have the same issues as in #8065 even with emitLegacyCommonJSImports: false.
Your Example Website or App
Currently I have no simple repo to provide. If you can't get anywhere without let me know. I try to find time to provide a stripped down repo.
Steps to Reproduce the Bug or Issue
- Generate code using provided config
- Import into Next.js app
- Run dev server
Expected behavior
There should be no .js in the fragment filename.
Screenshots or Videos
No response
Platform
- OS: macOS, Linux
- NodeJS: 16.15.1, 16.17.0
-
graphqlversion: 16.6.0 -
@graphql-codegen/*version(s):
├─ @graphql-codegen/[email protected]
├─ @graphql-codegen/[email protected]
│ └─ @graphql-codegen/[email protected]
├─ @graphql-codegen/[email protected]
├─ @graphql-codegen/[email protected]
├─ @graphql-codegen/[email protected]
├─ @graphql-codegen/[email protected]
├─ @graphql-codegen/[email protected]
├─ @graphql-codegen/[email protected]
├─ @graphql-codegen/[email protected]
├─ @graphql-codegen/[email protected]
├─ @graphql-codegen/[email protected]
├─ @graphql-codegen/[email protected]
└─ @graphql-codegen/[email protected]
Codegen Config File
overwrite: true
schema: "src/graphql/Schema/*.graphqls"
documents: "src/graphql/**/*.graphql"
emitLegacyCommonJSImports: false
hooks:
afterAllFileWrite:
- prettier --write
config:
avoidOptionals: true
withComponent: false
withHOC: false
withHooks: true
nonOptionalTypename: true
preResolveTypes: true
documentMode: documentNodeImportFragments
pureMagicComment: true
dedupeFragments: true
scalars:
Cursor: string
Time: Date
generates:
src/graphql/types.generated.ts:
plugins:
- add:
content: "/* eslint-disable */"
- "typescript"
src/utilities/Apollo/FragmentTypes.generated.ts:
plugins:
- add:
content: "/* eslint-disable */"
- "fragment-matcher"
src/utilities/Apollo/Helpers.generated.ts:
plugins:
- add:
content: "/* eslint-disable */"
- "typescript-apollo-client-helpers"
src/:
preset: near-operation-file
presetConfig:
baseTypesPath: 'graphql/types.generated.ts'
extension: .generated.tsx
config:
fetcher:
endpoint: 'http://localhost/graphql'
plugins:
- add:
content: "/* eslint-disable */"
- "typescript-operations"
- add:
content: |
export type DummyTypeExport = Types.Exact<{ [key: string]: never }>;
- "typescript-react-apollo"
Additional context
No response