Skip to content

Commit e4f765b

Browse files
koprivajakubclaude
andcommitted
πŸ“ docs(graphql-codegen-client-preset): monorepo paths
- callout that Next.js uses the Turbopack workspace root (lockfile directory) as the SWC cwd, not the Next app directory - add a Turborepo example using a workspace-root-relative artifactDirectory ("apps/web/src/gql") so monorepo users get a copy-pasteable config Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 2992039 commit e4f765b

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

  • contrib/graphql-codegen-client-preset

β€Žcontrib/graphql-codegen-client-preset/README.mdβ€Ž

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,22 @@ const nextConfig = {
5353
};
5454
```
5555

56+
> **Monorepos:** Next.js uses [Turbopack's workspace root](https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopack#root-directory) β€” the directory containing your lockfile (`yarn.lock`, `pnpm-lock.yaml`, etc.) β€” as the SWC `cwd`. If your Next app lives below that root, write `artifactDirectory` as a path from the workspace root down to the codegen output, not as a path relative to the Next app:
57+
58+
```ts
59+
// apps/web/next.config.mjs, in a Turborepo where yarn.lock sits at the repo root
60+
const nextConfig = {
61+
experimental: {
62+
swcPlugins: [
63+
[
64+
"@swc-contrib/plugin-graphql-codegen-client-preset",
65+
{ artifactDirectory: "apps/web/src/gql", gqlTagName: "graphql" },
66+
],
67+
],
68+
},
69+
};
70+
```
71+
5672
#### `.swcrc`
5773

5874
```json5

0 commit comments

Comments
Β (0)