|
| 1 | +--- |
| 2 | +title: Client Preset SWC plugin is Officially Supported by the SWC Team |
| 3 | +description: |
| 4 | + Announcing the new home, package name and support from SWC team for the Client Preset SWC plugin. |
| 5 | +date: 2025-07-19 |
| 6 | +authors: eddeee888 |
| 7 | +tags: [graphql, graphql-code-generator, graphql-codegen, client-preset, swc-plugin] |
| 8 | +--- |
| 9 | + |
| 10 | +We're excited to announce that the Client Preset |
| 11 | +[SWC plugin](https://www.npmjs.com/package/@graphql-codegen/client-preset-swc-plugin) is now |
| 12 | +officially part of the |
| 13 | +[swc-project/plugins](https://github.com/swc-project/plugins/tree/main/contrib/graphql-codegen-client-preset) |
| 14 | +repo - maintained and supported by the SWC team! |
| 15 | + |
| 16 | +To use the new package, simply install it: |
| 17 | + |
| 18 | +```sh npm2yarn |
| 19 | +npm i -D @swc-contrib/plugin-graphql-codegen-client-preset |
| 20 | +``` |
| 21 | + |
| 22 | +Then, use it in place of the old package: |
| 23 | + |
| 24 | +```ts |
| 25 | +// next.config.js |
| 26 | +const nextConfig = { |
| 27 | + // ... |
| 28 | + experimental: { |
| 29 | + swcPlugins: [ |
| 30 | + [ |
| 31 | + '@swc-contrib/plugin-graphql-codegen-client-preset', |
| 32 | + { artifactDirectory: './src/gql', gqlTagName: 'graphql' } |
| 33 | + ] |
| 34 | + ] |
| 35 | + } |
| 36 | +} |
| 37 | +``` |
| 38 | + |
| 39 | +For other use cases, check the |
| 40 | +[updated documentation](https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#swc-plugin)! |
| 41 | + |
| 42 | +This plugin has been an essential part to |
| 43 | +[reduce bundle size](https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size) |
| 44 | +when integrating Client Preset into frameworks with SWC, such as Next.js and Vite. However, SWC |
| 45 | +plugins are currently not backwards compatible which means every time there was a new release in the |
| 46 | +`swc_core` package, `@graphql-codegen/client-preset-swc-plugin` version needed to be updated. |
| 47 | + |
| 48 | +We created [an issue](https://github.com/dotansimha/graphql-code-generator/issues/10379) to gather |
| 49 | +thoughts from the community on how to move forward with (1) guaranteed stability of the package and |
| 50 | +(2) minimal involvement from Codegen maintainers. Almost immediately, |
| 51 | +[@kdy1dev](https://x.com/kdy1dev) (Donny, the creator of SWC) made the suggestion to move the |
| 52 | +project to `swc-project/plugins`, which solved all the problems! |
| 53 | + |
| 54 | +Needless to say, this is a great solution for the community. Again, big shoutout to Donny for |
| 55 | +supporting us! |
0 commit comments