0.1.4 • Published 3 years ago
swc-plugin-graphql-codegen-client-preset-optimizer-test v0.1.4
SWC-plugin-graphql-codegen-client-preset-optimizer
This is currently a sandbox for a pull request for the GraphQL Code Generator client preset.
Large scale projects might want to enable code splitting or tree shaking and reducing the bundle size
on the client-preset generated files. This is because instead of using the map which contains all GraphQL
operations in the project, we can use the specific generated document types.
Usage/ Test it
Testing is highly appreciated! You can test the SWC plugin by installing the swc plugin:
npm i -D swc-plugin-graphql-codegen-client-preset-optimizer-test
yarn add -D swc-plugin-graphql-codegen-client-preset-optimizer-test
pnpm i -D swc-plugin-graphql-codegen-client-preset-optimizer-testAnd configuring it in your .swcrc:
{
// ...
"jsc": {
// ...
"experimental": {
"plugins": [
[
"swc-plugin-graphql-codegen-client-preset-optimizer-test",
{ "artifactDirectory": "./src/gql", "gqlTagName": "graphql" }
]
]
}
}
}or in your next.config.js:
const nextConfig = {
// ...
experimental: {
swcPlugins: [
[
'swc-plugin-graphql-codegen-client-preset-optimizer-test',
{ artifactDirectory: './src/gql', gqlTagName: 'graphql' }
]
]
}
}Note that you will need to provide the artifactDirectory path that should be the same as the one configured in your codegen.ts.
Issues
Please report any issues at the pull request. Thanks!