Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions contrib/graphql-codegen-client-preset/README.tmpl.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,24 @@ const nextConfig = {
};
```

> **Monorepos with Turbopack:** Turbopack passes its [root directory](https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopack#root-directory) to SWC as the `cwd`. By default this is the workspace root (the directory containing your lockfile, e.g. `yarn.lock` or `pnpm-lock.yaml`), not the Next.js app directory. If your app lives below that root, write `artifactDirectory` as a path from the workspace root. This does not apply to webpack builds, or if you set `turbopack.root` to the app directory. In those cases, keep the path relative to the app.

```ts
// apps/web/next.config.mjs, in a monorepo where the lockfile sits at the repo root
const nextConfig = {
experimental: {
swcPlugins: [
[
"@swc-contrib/plugin-graphql-codegen-client-preset",
{ artifactDirectory: "apps/web/src/gql", gqlTagName: "graphql" },
],
],
},
};

export default nextConfig;
```

#### `.swcrc`

```json5
Expand Down
Loading