Skip to content

docs(graphql-codegen-client-preset): document monorepo artifactDirectory with Turbopack - #694

Merged
Donny/강동윤 (kdy1) merged 1 commit into
mainfrom
kdy1/fix-issue-693
Nov 26, 2026
Merged

Donny/강동윤 (kdy1) merged 1 commit into
mainfrom
kdy1/fix-issue-693

Conversation

@kdy1

Copy link
Copy Markdown
Member

In a monorepo (for example, Turborepo with pnpm or Yarn workspaces), the Next.js app is often in a subdirectory of the workspace root. Turbopack passes its root directory to SWC as the cwd. By default, this is the directory that contains the lockfile. The plugin resolves a relative artifactDirectory from that cwd. Thus the value ./src/gql from the README's Next.js example points to <workspace-root>/src/gql, and the build fails with:

Module not found: Can't resolve './../../../../src/gql/graphql'

This PR adds a note after the Next.js example in contrib/graphql-codegen-client-preset/README.tmpl.md. The note tells users to write artifactDirectory as a path from the workspace root when the app is below the Turbopack root. It also shows an example configuration. The note says that this does not apply to webpack builds, or when turbopack.root is the app directory. The text comes from the proposal in the issue.

Only the template changes. scripts/bump-npm.sh generates README.md from the template at the next release.

Local validation: git diff --check passed. No other local validation was performed.

Closes #693

…ory with Turbopack

In a monorepo, Turbopack passes its root directory (by default, the
directory that contains the lockfile) to SWC as the `cwd`. The plugin
resolves a relative `artifactDirectory` from that `cwd`, so the
README's Next.js example (`./src/gql`) points to the workspace root
instead of the Next.js app directory, and the build fails with
"Module not found".

Add a note after the Next.js example that tells users to write
`artifactDirectory` as a path from the workspace root in this case, and
show an example.

Closes #693

Co-authored-by: Jakub Kopřiva <6573164+koprivajakub@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 26119c1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T01:21:00.599139Z 26119c1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kdy1
Donny/강동윤 (kdy1) merged commit e1a2990 into main Nov 26, 2026
9 of 10 checks passed
@kdy1
Donny/강동윤 (kdy1) deleted the kdy1/fix-issue-693 branch November 26, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

graphql-codegen-client-preset: document monorepo artifactDirectory paths with Turbopack

1 participant