graphql-codegen-webpack
Integrates GraphQL Code Generator with Webpack
const GraphQLCodegenPlugin = ; schema: 'src/schema.graphql' template: 'graphql-codegen-typescript-template' out: 'src/types.ts' overwrite: true;
Full example of webpack configuration:
const GraphQLCodegenPlugin = ; moduleexports = mode: 'development' devtool: 'inline-source-map' entry: './src/index.ts' output: filename: 'bundle.js' resolve: extensions: '.ts' '.ts' '.js' '.mjs' plugins: // GraphQL Code Generator schema: 'src/schema.graphql' template: 'graphql-codegen-typescript-template' out: 'src/types.ts' overwrite: true module: rules: test: /\.ts$/ loader: 'ts-loader' test: /\.mjs$/ include: /node_modules/ type: 'javascript/auto' ;