apollographql / apollo-link-state

✨ Manage your application's state with Apollo!
MIT License
1.4k stars 100 forks source link

updating from 0.4.1 to 0.4.2 causes app to error on startup #299

Open barbalex opened 6 years ago

barbalex commented 6 years ago

This is the error:

Uncaught ReferenceError: require is not defined
    at Object../node_modules/graphql/jsutils/instanceOf.mjs (instanceOf.mjs:31)
    at __webpack_require__ (bootstrap:772)
    at fn (bootstrap:141)
    at Object../node_modules/graphql/type/definition.mjs (definition.mjs:1)
    at __webpack_require__ (bootstrap:772)
    at fn (bootstrap:141)
    at Object../node_modules/graphql/type/validate.mjs (validate.mjs:1)
    at __webpack_require__ (bootstrap:772)
    at fn (bootstrap:141)
    at Object../node_modules/graphql/graphql.mjs (graphql.mjs:1)
    at __webpack_require__ (bootstrap:772)
    at fn (bootstrap:141)
    at Object../node_modules/graphql/index.mjs (index.mjs:1)
    at __webpack_require__ (bootstrap:772)
    at fn (bootstrap:141)
    at Object../node_modules/apollo-link-state/lib/utils.js (utils.js:1)
    at __webpack_require__ (bootstrap:772)
    at fn (bootstrap:141)
    at Object../node_modules/apollo-link-state/lib/index.js (index.js:1)
    at __webpack_require__ (bootstrap:772)
    at fn (bootstrap:141)
    at Object../src/client.js (index.css:9)
    at __webpack_require__ (bootstrap:772)
    at fn (bootstrap:141)
    at Object../src/index.js (index.css?42ca:45)
    at __webpack_require__ (bootstrap:772)
    at fn (bootstrap:141)
    at Object.0 (theme.js:20)
    at __webpack_require__ (bootstrap:772)
    at checkDeferredModules (bootstrap:43)
    at Array.webpackJsonpCallback [as push] (bootstrap:30)
    at main.chunk.js:1

This is my package.json file before updating to v0.4.2: https://github.com/barbalex/apf2/blob/4848dc638c5849e6d50282647fb74fd2f165c4d8/package.json

I am using yarn's resolutions feature to prevent problems that occured due to different versions of graphql required in different apollo tools. Maybe enforcing graphql v0.13.2 is causing this?

barbalex commented 6 years ago

I removed the graphql "resolutions" setting and tried:

When I did not install graphql myself, the installed version was 0.13.2.

Is it possible that some new feature of apollo-link-state depends on graphql > 0.13.2 being installed?

This would be a bit risky seeing that apollo-client only installs v0.13.2 now: https://github.com/apollographql/apollo-client/blob/feb6617466fd144ca063133351e880590673f5ce/package.json#L108

jsteenkamp commented 6 years ago

I'm seeing the same error. Updating GraphQL as you show worked.

mlwilkerson commented 6 years ago

Same error here too. Same solution worked.

evilosa commented 6 years ago

You can use temp solution with a latest graphql. Add resolutions to package.json "resolutions": { "**/apollo-link-state": "0.4.1" },