Skip to content

--watch not working with full pathsΒ #10388

@flippidippi

Description

@flippidippi

Which packages are impacted by your issue?

@graphql-codegen/cli

Describe the bug

When using full paths for codegen in a subfolder, the codegen works, but --watch does not.

Your Example Website or App

https://codesandbox.io/p/sandbox/graphql-code-generator-full-path-watch-pst92d

Steps to Reproduce the Bug or Issue

  1. Run yarn start
  2. Notice the types file has the correct code
  3. Remove id from the user query
  4. Notice the codegen does not notice the change and types file is still selecting id

Expected behavior

When updating the query, codegen should rerun.

Screenshots or Videos

No response

Platform

  • OS: Linux
  • NodeJS: 20.12.1
  • graphql version: 16.2.0
  • @graphql-codegen/* version(s):
    • add: 5.0.3
    • cli: 5.0.7
    • typescript: 4.1.6
    • typescript-operations: 4.6.1
  • @parcel/watcher: 2.5.1

Codegen Config File

import { CodegenConfig } from "@graphql-codegen/cli";
import { join } from "path";

const config: CodegenConfig = {
  schema: join(__dirname, "schema.graphql"),
  documents: join(__dirname, "document.graphql"),
  generates: {
    [join(__dirname, "types.ts")]: {
      plugins: ["typescript", "typescript-operations"],
    },
  },
};

export default config;

Additional context

We needed to use exact full paths because we are in a monorepo and the graphql linter is run from the top level of the repo and the codegen is run from the subfolder.

It looks like the initial codegen does work, it just doesn't watch properly.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions