website/src/pages/plugins/other/add.mdx
import { PluginApiDocs, PluginHeader } from '@/components/plugin' import { pluginGetStaticProps } from '@/lib/plugin-get-static-props' export const getStaticProps = pluginGetStaticProps(__filename)
<PluginHeader />add plugin adds custom text to your output file.
You can use this plugin to add custom code, imports, comments and more to your output file.
import type { CodegenConfig } from '@graphql-codegen/cli'
const config: CodegenConfig = {
// ...
generates: {
'path/to/file.ts': {
plugins: [
{
add: {
content: '/* eslint-disable */'
}
},
'typescript'
]
}
}
}
export default config
import type { CodegenConfig } from '@graphql-codegen/cli'
const config: CodegenConfig = {
// ...
generates: {
'path/to/file.ts': {
plugins: [
{
add: {
content: ['declare namespace GraphQL {']
}
},
{
add: {
placement: 'append',
content: '}'
}
},
'typescript'
]
}
}
}
export default config