Closed
Description
I'am getting error at query declaration.
index.js:128 Uncaught TypeError: parse is not a function
Debugging, I realized the method parse at node_modules/graphql-tag/src/index.js
is really undefined:
//node_modules/graphql-tag/src/index.js
var parser = require('graphql/language/parser');
var parse = parser.parse; //parse is undefined
//...
//line 128
var parsed = parse(doc); //parse is not a function
This is my code. I'm using create-react-app (v 1.5.1) and already tried to rewire. Also didn't work with the example query.
import { graphql } from 'react-apollo'
import gql from 'graphql-tag'
const CREATE_USER_MUTATION = gql`
mutation createUserMutation ($name: String, $email: String, $category: String, $phone: String, $defaultAddress: String, $image: String, $updatedAt: Int, $createdAt: Int) {
createUser(name: $name, email: $email, category: $category, phone: $phone, defaultAddress: $defaultAddress, image: $image, updatedAt: $updatedAt, createdAt: $createdAt) {
id
name
email
category
phone
defaultAddress
createdAt
}
}
`
export default graphql(CREATE_USER_MUTATION, {name: 'createUserMutation'})
The query can be parsed well at AST explorer.
Can anyone help me?
Metadata
Metadata
Assignees
Labels
No labels