dotansimha / graphql-code-generator

A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.
https://the-guild.dev/graphql/codegen/
MIT License
10.78k stars 1.31k forks source link

"Longest common prefix () is not accessible" on Windows #9526

Open srmagura opened 1 year ago

srmagura commented 1 year ago

Which packages are impacted by your issue?

@graphql-codegen/cli

Describe the bug

On Windows, running graphql-codegen --watch prints this warning:

[Watcher] Longest common prefix () is not accessible
[Watcher] Watching current working directory (C:\Projects\oss\bugs\graphql-codegen-windows-repro\app) instead

This is problematic if your GraphQL schema file is outside of the directory in which graphql-codegen is run.

The issue does not occur on macOS or Linux.

Your Example Website or App

https://github.com/srmagura/graphql-codegen-windows-repro

Steps to Reproduce the Bug or Issue

See the README of the GitHub repository.

Expected behavior

No warnings when running graphql-codegen --watch.

Screenshots or Videos

No response

Platform

Codegen Config File

schema: ../schema.gql
documents:
  - "src/**/*.ts?(x)"
  - "!src/gql/**/*"
generates:
  src/gql/:
    preset: client

Additional context

No response

YassinEldeeb commented 1 year ago

Hey, can you please try this build, this better handles Windows paths for the watcher, but I need to verify if it solved it or not, I don't have a Windows machine with me.

https://www.npmjs.com/package/@graphql-codegen/cli/v/4.0.2-alpha-20230706143738-f59fb0497

srmagura commented 1 year ago

Thanks for looking into it! Unfortunately, I tried build 4.0.2-alpha-20230706143738-f59fb0497 and the behavior was unchanged.

YassinEldeeb commented 1 year ago

do you get a different output or is it still the same?

srmagura commented 1 year ago

Exact same output.