JSPM

graphql-codegen-webpack

0.14.0-alpha.cbd3f405
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q67258F
  • License MIT

Package Exports

  • graphql-codegen-webpack

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (graphql-codegen-webpack) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

graphql-codegen-webpack

Integrates GraphQL Code Generator with Webpack

const { GraphQLCodegenPlugin } = require('graphql-codegen-webpack');

new GraphQLCodegenPlugin({
  schema: 'src/schema.graphql',
  template: 'graphql-codegen-typescript-template',
  out: 'src/types.ts',
  overwrite: true
});

Full example of webpack configuration:

const { GraphQLCodegenPlugin } = require('graphql-codegen-webpack');

module.exports = {
  mode: 'development',
  devtool: 'inline-source-map',
  entry: './src/index.ts',
  output: {
    filename: 'bundle.js'
  },
  resolve: {
    extensions: ['.ts', '.ts', '.js', '.mjs']
  },
  plugins: [
    // GraphQL Code Generator
    new GraphQLCodegenPlugin({
      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'
      }
    ]
  }
};