dotansimha / dotansimha/graphql-code-generator-community
near-operation-file + typescript-react-apollo = Failed to resolve .js import
- Dominant language
- TypeScript
- Stars
- 137
- Forks
- 195
- Avg merge
- 6h 20m
- Merged PRs (30d)
- 16
Description
### Describe the bug
I still have the same issues as in dotansimha/graphql-code-generator#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
1. Generate code using provided config
2. Import into Next.js app
3. 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
- `graphql` version: 16.6.0
- `@graphql-codegen/*` version(s):
```
├─ @graphql-codegen/add@3.2.1
├─ @graphql-codegen/cli@2.12.0
│ └─ @graphql-codegen/plugin-helpers@2.7.0
├─ @graphql-codegen/core@2.6.2
├─ @graphql-codegen/fragment-matcher@3.3.1
├─ @graphql-codegen/introspection@2.2.1
├─ @graphql-codegen/near-operation-file-preset@2.4.1
├─ @graphql-codegen/plugin-helpers@2.6.2
├─ @graphql-codegen/schema-ast@2.5.1
├─ @graphql-codegen/typescript-apollo-client-helpers@2.2.3
├─ @graphql-codegen/typescript-operations@2.5.3
├─ @graphql-codegen/typescript-react-apollo@3.3.3
├─ @graphql-codegen/typescript@2.7.3
└─ @graphql-codegen/visitor-plugin-common@2.12.1
```
### Codegen Config File
```yaml
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_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.