Skip to content

Commit

Permalink
Fix duplicate graphql package bug by checking for local installation
Browse files Browse the repository at this point in the history
See graphql/graphiql#58 for more info
  • Loading branch information
mfix22 committed Mar 14, 2017
1 parent 5d7599a commit ab5a39a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
const axios = require('axios')
const { graphql } = require('graphql')
const path = require('path')

let GraphQL
try {
// do to GraphQL schema issue [see](https://github.com/graphql/graphiql/issues/58)
GraphQL = require(path.join(process.cwd(), './node_modules/graphql'))
} catch (e) {
// fallback if graphql is not installed locally
GraphQL = require('graphql')
}

const { graphql } = GraphQL
const { correctURL, encode, DEFAULT_CONFIG } = require('./util')

function Gest (schema, config = {}) {
Expand Down

0 comments on commit ab5a39a

Please sign in to comment.