Open mplayer78 opened 4 years ago
I had something similar to this - fixed by duplicating /gatsby-browser.js content in /gatsby-ssr.js - you can create a module to import the client etc into each file to keep things DRY.
This helped me work a few bits out when I was using Apollo with Gatbsy: https://github.com/jlengstorf/gatsby-with-apollo
@bcwatson22 Thank you for your solution. Copying the same to both gatsby-browser.js and gatsby-ssr.js fixed my issue of invariant violation while building gatsby with @apollo/react-hooks.
Thankyou, this seems to have sorted the problem. Thanks for taking the time.
Whilst my app will run in dev, whenever I go to build I am getting a ``` WebpackError: Invariant Violation: Invariant Violation: 46 (see https://github.com/apollographql/invariant-packages)
invariant.esm.js:12 new InvariantError node_modules/ts-invariant/lib/invariant.esm.js:12:1
invariant.esm.js:24 invariant node_modules/ts-invariant/lib/invariant.esm.js:24:1
OperationData.js:30 MutationData../node_modules/@apollo/client/react/data/OperationData.js.OperationData.refreshClient node_modules/@apollo/client/react/data/OperationData.js:30:58
MutationData.js:38 MutationData../node_modules/@apollo/client/react/data/MutationData.js.MutationData.execute node_modules/@apollo/client/react/data/MutationData.js:38:45
useMutation.js:27 useMutation node_modules/@apollo/client/react/hooks/useMutation.js:27:1
ConfirmationButton.js:32 ConfirmationButton src/components/ConfirmationButton.js:32:44