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 6This automatically finds the most specific import from the graphql module's files and folders that works 7across GraphQL.js v14, v15, and v16. 8 9## Getting Started 10 11```sh 12npm install --save-dev babel-plugin-modular-graphql 13# or 14yarn add --dev babel-plugin-modular-graphql 15``` 16 17And add the plugin to your Babel config; it doesn't take any options. 18 19## Example 20 21Imports like these: 22 23```js 24import { parse, Kind } from 'graphql'; 25``` 26 27Become: 28 29```js 30import { parse } from "graphql/language/parser"; 31import { Kind } from "graphql/language/kinds"; 32``` 33 34## Limitations 35 36- The plugin currently does not support `require()` 37- 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.