question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The v3.4.0-beta.15 doesn't work buildless

See original GitHub issue

Intended outcome:

Just working, as previous version.

Actual outcome:

I get an error when update from v3.4.0-beta.14 to v3.4.0-beta.15: Screenshot 2021-03-22 at 14 12 57

This file is: https://github.com/graphql/graphql-js/blob/v15.2.0/src/jsutils/instanceOf.js#L14 But that file hasn’t changed since January 2020.

All works if I go back to v3.4.0-beta.14.

I’m using the @web/dev-server.

How to reproduce the issue:

Just importing and setup Apollo Client.

Versions

It happens only in v3.4.0-beta.15 and v3.4.0-beta.16. All works if I go back to v3.4.0-beta.14.

Reference: https://github.com/apollographql/apollo-client/pull/7399

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

4reactions
benjamncommented, Mar 25, 2021

@abdonrd Thanks for testing the betas and reporting this issue!

This is a consequence of https://github.com/apollographql/invariant-packages/pull/94, and it unfortunately reveals that the graphql package is not designed to be used without a build step, since it contains a naked reference to the global process variable. This is a common assumption in the React ecosystem, for better or worse.

Does @web/dev-server have any build/minification options for replacing expressions like process.env.NODE_ENV with constant strings? If not, you may need to provide your own global process.env polyfill to keep using the graphql package without the global.process stub that ts-invariant was previously providing.

The reason https://github.com/graphql/graphql-js/pull/2894 is relevant is that @IvanGoncharov mentioned they might stop using process.env.NODE_ENV in graphql@16, which would be a welcome improvement, since it would allow graphql to run in a browser without a build step.

3reactions
bennypowerscommented, Jul 28, 2021

Thanks!

Yeah, Those were the only ones I found in apollo-elements, which tries its best to expose the full breadth of the core apis

@abdonrd shared this screenshot with me, which I’m reposting with permission

Screenshot 2021-07-27 at 12 50 30

I reproduced this locally, then after confirming those 8 errors, I published a fix with some workarounds, mostly by reexporting type aliases. https://github.com/apollo-elements/apollo-elements/commit/30a31ea10f011ebc9231e4396f813bbe190a2006 see especially packages/core/types.ts in that diff.

I haven’t gone over /link and friends as carefully (and certainly not /react), but updating some of my demo apps so far has been smooth. I wouldn’t typically expect app-buildery kind of users to go mucking around too much with those types.

Thanks 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found