-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
graphql-compose throws 'Uncaught ReferenceError: require is not defined' #15633
Comments
Same error in v2.13.0, v2.12.1, v2.11.6, v2.11.0. Works in v2.10.5 with terser pinned to v4.0.0 by resolutions. So it seems v2.11.0 causes the problem: https://github.com/gatsbyjs/gatsby/compare/gatsby@2.10.5...gatsby@2.11.0. As gatsby v2.10.5 includes the same version of graphql-compose as v2.13.14, namely 6.3.5, the change has probably happened in gatsby. Could it be that a babel/webpack change prevents global require calls? That is what is done in the failing module: https://github.com/graphql-compose/graphql-compose/blob/master/src/utils/graphqlVersion.js |
How is |
|
Yes, gatsby depend on it for schema creation - but not as runtime dependency (webpack shouldn't try to load it). Looking at stack trace you pasted:
It seems like somehow its being imported potentially in |
I can't see how that code line should cause this: https://github.com/barbalex/apf2/blob/3a8f2de39792a4d785c44d9d47559f58b2c0de42/src/components/shared/Files/index.js#L81 |
Ah, well, it is a graphql query... |
I am now getting this warning when updating gatsby-transformer-remark:
So would be glad if this issue could be adressed. |
I tried updating another gatsby project of mine. There this issue is not occuring (save for #15750) |
also bumping into issues with gatsby-source-filesystem: same as here #15680. So basically I am now blocked from updating most anything that has to do with gatsby :-( |
I just updated gatsby then
and got the error again. @pieh So basically you should be able to reproduce this by doing:
The project needs a local api server. But this error seems to occur before the project connects to the api so that does not prevent reproduction of the issue. |
I just tried to reproduce this on my MacBook pro (my normal dev machine is a windows pc). The issue happens exact same. |
It looks like you're importing Graphql-compose is a nodejs project which doesn't work in the browser. If you need a const capitalize = (s) => {
return s.charAt(0).toUpperCase() + s.slice(1)
} |
facepalm this shows:
I am really sorry for bugging you guys. Thanks a lot for this great tool and your patience. |
No worries, it happens to the best of us ❤️ |
Description
I am trying to recover from #15249 and finally be able to update my gatsby version which has had to remain at v2.10.0, with terser version fixed by yarn resolutions.
So I updated gatsby to v2.13.14 and removed the yarn resolution, as #15249 should have been resolved a few versions ago.
Now I can run
gastby develop
sucessfully. But when I open the project in the browser the dev tools show this error:When I run
yarn why graphql-compose
I get:Environment
The text was updated successfully, but these errors were encountered: