Mirror: Modular GraphQL.js import paths without the hassle.
1# babel-plugin-modular-graphql
2
3A small transform plugin to cherry-pick GraphQL modules so you don’t have to.
4Basically [babel-plugin-lodash](https://github.com/lodash/babel-plugin-lodash) for [graphql](https://github.com/graphql/graphql-js).
5
6## Getting Started
7
8```sh
9npm install --save-dev babel-plugin-modular-graphql
10# or
11yarn add --dev babel-plugin-modular-graphql
12```
13
14And add the plugin to your Babel config; it doesn't take any options.
15
16## Example
17
18Imports like these:
19
20```js
21import { parse, Kind } from 'graphql';
22```
23
24Become:
25
26```js
27import { parse } from "graphql/language/parser";
28import { Kind } from "graphql/language/kinds";
29```
30
31## Limitations
32
33- The plugin currently does not support `require()`
34- The plugin automatically generates an import-map that drills down into `graphql`'s files. This may break if files at a depth of 1–2 change their names.