@evo/graphql-tag-loader

1.0.1 • Public • Published

@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'
    }
  ],
  ...
}

Readme

Keywords

none

Package Sidebar

Install

npm i @evo/graphql-tag-loader

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

7.87 kB

Total Files

4

Last publish

Collaborators

  • stoyanovk
  • lequan
  • zemlanin
  • alexander
  • seedofjoy
  • 041616
  • docccdev
  • orhideous
  • tailhook
  • hunson.abadeer
  • mark_tven
  • amostovenko
  • sadkovoy
  • himiranov
  • evo-kazymyrov