apollo-link-state icon indicating copy to clipboard operation
apollo-link-state copied to clipboard

updating from 0.4.1 to 0.4.2 causes app to error on startup

Open barbalex opened this issue 6 years ago • 4 comments

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 avatar Sep 16 '18 15:09 barbalex

I removed the graphql "resolutions" setting and tried:

  • not installing graphql: did not work. Same error as before
  • installing graphql v14.0.2: works

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

barbalex avatar Sep 16 '18 15:09 barbalex

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

jsteenkamp avatar Sep 20 '18 00:09 jsteenkamp

Same error here too. Same solution worked.

mlwilkerson avatar Sep 23 '18 22:09 mlwilkerson

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

evilosa avatar Nov 08 '18 12:11 evilosa