1.0.1 • Published 6 months ago

@evo/graphql-tag-loader v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

@evo/graphql-tag-loader

More optimized loader for lib graphql-tag:

If you have configured the webpack @evo/graphql-tag-loader, you can import modules containing graphQL queries. The imported value will be the pre-built AST.

import MyQuery from 'query.graphql';

Importing queries by name

You can also import query and fragment documents by name.

query MyQuery1 {
  ...
}

query MyQuery2 {
  ...
}

And in your JavaScript:

import { MyQuery1, MyQuery2 } from 'query.graphql';

Webpack loading and preprocessing

Using the included @evo/graphql-tag-loader it is possible to maintain query logic that is separate from the rest of your application logic. With the loader configured, imported graphQL files will be converted to AST during the webpack build process.

Example webpack configuration

{
  ...
  loaders: [
    {
      test: /\.(graphql|gql)$/,
      exclude: /node_modules/,
      loader: '@evo/graphql-tag-loader'
    }
  ],
  ...
}
1.0.1

6 months ago

1.0.0

6 months ago