dotansimha / dotansimha/graphql-code-generator
Can't build app with @graphql-codegen/client-preset-swc-plugin
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
### Which packages are impacted by your issue?
@graphql-codegen/client-preset-swc-plugin
### Describe the bug
I'm using the Vite React implementation.
I was using the `swc-plugin-graphql-codegen-client-preset-optimizer-test` version without any problems but after updating some deps this one stopped working.
```
react({
plugins: [
[
'swc-plugin-graphql-codegen-client-preset-optimizer-test',
{
artifactDirectory: '../../packages/data-access/src/gql',
},
],
],
}),
```
Same with the following config:
```
react({
plugins: [
[
'@graphql-codegen/client-preset-swc-plugin',
{
artifactDirectory: '../../packages/data-access/src/gql',
},
],
],
}),
```
where react is an import as `import react from '@vitejs/plugin-react-swc';`
I always get the same error:
```
ERROR: The character ">" is not valid inside a JSX element
ERROR: Unexpected end of file before a closing "" tag
```
removing the plugin altogether fixes my issue.
### Your Example Website or App
/
### Steps to Reproduce the Bug or Issue
/
### Expected behavior
Build should not fail
### Screenshots or Videos
_No response_
### Platform
- OS: [Linux]
- NodeJS: [e.g. 18.15.0]
- `graphql` version: [e.g. ^16.6.0]
- `@graphql-codegen/*` version(s): [e.g. 3.2.2 and client-preset 2.1.1]
### Codegen Config File
```
import { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: '/app/apps/api/storage/app/lighthouse-schema.graphql',
documents: ['src/**/*.tsx', '!src/gql/**/*'],
verbose: true,
generates: {
'./src/gql/': {
preset: 'client',
plugins: [],
config: {
skipTypename: false,
enumsAsTypes: true,
},
},
},
};
export default config;
```
### Additional context
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.