@@ -617,26 +617,10 @@ module.exports = {
617
617
618
618
### SWC Plugin
619
619
620
- <Callout type = " warning" >
621
- As of 2023/03/11, SWC's custom plugins is still an experimental feature, that means unexpected breaking changes that
622
- makes specific nextjs versions or our plugin incompatible are possible, so please file an issue
623
- [ here] ( https://github.com/dotansimha/graphql-code-generator/issues/new?assignees=&labels=&template=bug_report.yml&title=@graphql-codegen/client-preset-swc-plugin%20... )
624
- if you faced any unexpected behavior/errors while using the plugin.
625
-
626
- Pro tip: if you faced the following obscure error, or the nextjs ` dev ` script just instantly terminates the process without any errors,
627
- it most likely means that SWC is not happy with your nextjs version, so try upgrading it to ` latest ` if possible,
628
- then let us know of your current broken version to try fixing it or documenting its no longer supported.
629
-
630
- ``` sh
631
- thread ' <unnamed>' panicked at ' failed to invoke plugin: failed to invoke plugin on ' Some(" /app/node_modules/next/dist/client/router.js" )'
632
- ```
633
-
634
- </Callout>
635
-
636
620
The SWC plugin is not bundled in the ` client-preset ` package, so you will need to install it separately:
637
621
638
622
``` sh npm2yarn
639
- npm i -D @graphql-codegen/ client-preset-swc-plugin
623
+ npm i -D @swc-contrib/plugin- graphql-codegen- client-preset
640
624
```
641
625
642
626
#### General
@@ -650,7 +634,7 @@ To use the SWC plugin without Next.js, update your `.swcrc` to add the following
650
634
// ...
651
635
experimental: {
652
636
plugins: [
653
- [' @graphql-codegen/ client-preset-swc-plugin ' , { artifactDirectory: ' ./src/gql' , gqlTagName: ' graphql' }]
637
+ [' @swc-contrib/plugin- graphql-codegen- client-preset' , { artifactDirectory: ' ./src/gql' , gqlTagName: ' graphql' }]
654
638
]
655
639
}
656
640
}
@@ -670,7 +654,7 @@ export default defineConfig({
670
654
plugins: [
671
655
react ({
672
656
plugins: [
673
- [' @graphql-codegen/ client-preset-swc-plugin ' , { artifactDirectory: ' ./src/gql' , gqlTagName: ' graphql' }]
657
+ [' @swc-contrib/plugin- graphql-codegen- client-preset' , { artifactDirectory: ' ./src/gql' , gqlTagName: ' graphql' }]
674
658
]
675
659
})
676
660
]
@@ -686,7 +670,7 @@ const nextConfig = {
686
670
// ...
687
671
experimental: {
688
672
swcPlugins: [
689
- [' @graphql-codegen/ client-preset-swc-plugin ' , { artifactDirectory: ' ./src/gql' , gqlTagName: ' graphql' }]
673
+ [' @swc-contrib/plugin- graphql-codegen- client-preset' , { artifactDirectory: ' ./src/gql' , gqlTagName: ' graphql' }]
690
674
]
691
675
}
692
676
}
0 commit comments