Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build app with @graphql-codegen/client-preset-swc-plugin #9195

Open
Tracked by #9489
DaLukasDev opened this issue Mar 17, 2023 · 1 comment
Open
Tracked by #9489

Can't build app with @graphql-codegen/client-preset-swc-plugin #9195

DaLukasDev opened this issue Mar 17, 2023 · 1 comment
Labels
kind/bug Bug :-( stage/1-reproduction A reproduction exists

Comments

@DaLukasDev
Copy link

DaLukasDev commented Mar 17, 2023

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

@saihaj saihaj added kind/bug Bug :-( stage/1-reproduction A reproduction exists labels Mar 23, 2023
@YassinEldeeb YassinEldeeb mentioned this issue Jun 6, 2023
8 tasks
@YassinEldeeb
Copy link
Collaborator

Hey, thanks for reporting! We are currently tracking the issue with SWC maintainers to figure out a solution.

Please add a 👍 to the issue and feel free to join the conversation.
swc-project/swc#8315

I'll keep you updated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Bug :-( stage/1-reproduction A reproduction exists
Projects
None yet
Development

No branches or pull requests

3 participants