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

  • Operating System: Windows_NT
  • Node Version: v20.13.1
  • Nuxt Version: 3.11.2
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.6
  • Package Manager: pnpm@9.1.1
  • Builder: -
  • User Config: site, app, css, routeRules, image, runtimeConfig, devtools, modules, experimental
  • Runtime Modules: @nuxtjs/tailwindcss@6.12.0, @nuxtjs/color-mode@3.4.1, @nuxt/image@1.7.0, nuxt-swiper@1.2.2, @vueuse/motion/nuxt@2.1.0, nuxt-graphql-client@0.2.34, @pinia/nuxt@0.5.1, @nuxtjs/seo@2.0.0-rc.10
  • Build Modules: -

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/@graphql-codegen+cli@5.0.2_@parcel+watcher@2.4.1_@types+node@20.12.11_encoding@0.1.13_graphql@16.8.1_typescript@5.4.5/node_modules/@graphql-codegen/cli/esm/codegen.js:89:19)
  at Task.task (/C:/Users/adask/WebstormProjects/amaifuku-frontend/node_modules/.pnpm/@graphql-codegen+cli@5.0.2_@parcel+watcher@2.4.1_@types+node@20.12.11_encoding@0.1.13_graphql@16.8.1_typescript@5.4.5/node_modules/@graphql-codegen/cli/esm/codegen.js:143:25)
  at Task.run (/C:/Users/adask/WebstormProjects/amaifuku-frontend/node_modules/.pnpm/listr2@4.0.5/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