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

On Windows HMR stopped working in version 0.2.34 #486

Open
EpicPlayerA10 opened this issue May 14, 2024 · 0 comments · May be fixed by #487
Open

On Windows HMR stopped working in version 0.2.34 #486

EpicPlayerA10 opened this issue May 14, 2024 · 0 comments · May be fixed by #487
Labels
bug Something isn't working

Comments

@EpicPlayerA10
Copy link

EpicPlayerA10 commented May 14, 2024

Environment

Describe the bug

On Windows HMR stopped working. When I try to save graphql file then types are not generating and it will throw me this error:

 ERROR  [unhandledRejection] Invalid Codegen Configuration!                                                                                                                                                               21:35:05  

        Please make sure that your codegen config file contains the "generates" field, with a specification for the plugins you need.

        It should looks like that:

        schema:
          - my-schema.graphql
        generates:
          my-file.ts:
            - plugin1
            - plugin2
            - plugin3


  Please make sure that your codegen config file contains the "generates" field, with a specification for the plugins you need.

  It should looks like that:

  schema:
  - my-schema.graphql
  generates:
  my-file.ts:
  - plugin1
  - plugin2
  - plugin3
  at normalize (/C:/Users/adask/WebstormProjects/amaifuku-frontend/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/codegen.js:89:19)
  at Task.task (/C:/Users/adask/WebstormProjects/amaifuku-frontend/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/codegen.js:143:25)
  at Task.run (/C:/Users/adask/WebstormProjects/amaifuku-frontend/node_modules/.pnpm/[email protected]/node_modules/listr2/dist/index.js:960:35)

The bug disappears when i'm on version older than 0.2.34

Expected behaviour

It should generate types correctly and should not throw this error.

Reproduction

No response

Additional context

I have debugged a little bit and I found that bug lies here:

.filter(k => ctx.clientDocs?.[k]?.some(e => e.endsWith(hmrDoc)))

I've debugged variables inside this some in format [var or expresion]: [value]:

e: C:/path/to/project/queries/Product.graphql
hmrDoc: queries\Product.graphql
e.endsWith(hmrDoc): false

You can see here that it tries to do endWith on path with forward slashes and the second path with backwards slashes.

The bug was introduced in cf8dfca . The node:path functions automatically convert paths to the OS ones. In this case it converted forward slashes to backwards slashes as i'm on windows.

Logs

No response

@EpicPlayerA10 EpicPlayerA10 added the bug Something isn't working label May 14, 2024
@EpicPlayerA10 EpicPlayerA10 linked a pull request May 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant