Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Export 'graphql' is not defined #2886

Closed
triketora opened this issue Mar 20, 2019 · 3 comments
Closed

Export 'graphql' is not defined #2886

triketora opened this issue Mar 20, 2019 · 3 comments

Comments

@triketora
Copy link

triketora commented Mar 20, 2019

Intended outcome:

I'm trying to get my static assets build on Heroku to run. I'm using Node 10.8.0, npm 6.8.0, and Parcel to build.

My package.json dependencies include:
"apollo-boost": "^0.1.28",
"apollo-client": "^2.5.1",
"apollo-link-context": "^1.0.17",
"react-apollo": "^2.5.1"

This was all running fine on Heroku up until a few hours ago when I tried to push and the build failed. I don't think I've changed anything that would have caused the build to start failing, but at this point I'm willing to believe anything.

Actual outcome:

remote:        With `useBuiltIns` option, required direct setting of `corejs` option
remote:
remote:        🚨  /tmp/build_504c6bd7d9d8fa28ec87253d43d990d7/node_modules/react-apollo/react-apollo.esm.js:1044:72: Export 'graphql' is not defined (1044:72)
remote:          1042 | }
remote:          1043 |
remote:        > 1044 | export { ApolloConsumer, ApolloProvider, Query, Mutation, Subscription, graphql, withQuery, withMutation, withSubscription, withApollo, getDataFromTree, renderToStringWithData, compose, RenderPromises, getMarkupFromTree };
remote:               |                                                                        ^
remote:          1045 |
remote:          1046 |

How to reproduce the issue:

I cannot reproduce this problem locally unfortunately. Whenever I push my project to Heroku, it does consistently fail in my heroku-postbuild step that runs npm run parcel:build.

Version

  • apollo-client@^2.5.1
  • react-apollo@^2.5.1
@hwillson
Copy link
Member

@triketora Just to verify, are you installing graphql as part of your deployment process? graphql is a react-apollo peer dependency, so you'll need to make sure it's installed yourself.

@triketora
Copy link
Author

@hwillson Yes, graphql is included in dependencies (Parcel is good about automatically including everything). Here is my full list of dependencies:

"devDependencies": { "@babel/core": "^7.3.4", "@babel/plugin-transform-runtime": "^7.3.4", "eslint": "^4.19.1", "npm-run-all": "^4.1.5", "parcel-bundler": "^1.12.2", "prettier-standard": "^8.0.1", "sass": "^1.15.3", "snazzy": "^8.0.0", "standard": "^12.0.1" }, "dependencies": { "@babel/runtime": "^7.3.4", "@babel/runtime-corejs2": "^7.3.4", "@sentry/browser": "^4.6.4", "apollo-boost": "^0.1.28", "apollo-client": "^2.5.1", "apollo-link-context": "^1.0.17", "graphql": "^14.1.1", "graphql-tag": "^2.10.1", "prop-types": "^15.7.2", "react": "^16.8.3", "react-apollo": "^2.5.1", "react-dom": "^16.8.3", "react-habitat": "^1.0.1", "react-twitter-embed": "^2.0.4" }

@triketora
Copy link
Author

Looks like it was the babel change that broke parcel. I was able to fix it with the suggestion to include "@babel/parser": "<7.4.0" as a dependency. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants