2.0.0-4 • Published 4 years ago

@gql2ts/loader v2.0.0-4

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

@gql2ts/from-query

This package is used to load graphql files into webpack using @gql2ts/from-query. generate types/interfaces from a GraphQL Schema and a query.

Installation

npm install @gql2ts/loader

Basic Usage in webpack configuration file:

Note: It is recommended to also include graphql-tag/loader in your webpack config, see below for an example

import Schema from './schema';

{
// ...
  module: {
    rules: {
      {
        test: /\.(graphql|gql)$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'graphql-tag/loader' // Recommended
          },
          {
            loader: '@gql2ts/loader',
            options: {
              schema: Schema, // Required
              typeMap: { }, // Optional: Partial<ITypeMap> from @gql2ts/types
              options: { } // Optional: IProvidedOptions from @gql2ts/types
            }
          }
        },
      ]
    },
  }
// ...
}