-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Runtime Error "require is not defined" when bundling with webpack #721
Comments
Getting the same.... :( |
Me too |
Fixed this issue by explicitly specifying latest release of graphql dependency: https://github.com/graphql/graphql-js/
|
…browserCryptoLib', upgrade version graphql for error: ReferenceError: require is not defined graphql/graphiql#721, TODO: jest error Emit Skipped, Not Tested: IAM autentication and complex object
I had this error with another project with
As Stereobit explained, "Graphql-js uses |
we have a webpack example now, 0.17.0 should build just fine! just be sure to follow the example webpack and babel config. |
When bundling graphiql with webpack, you get this error at runtime:
This is because
instanceOf.js
ingraphql
contains a reference toprocess.env
: https://github.com/graphql/graphql-js/blob/dec24f9/src/jsutils/instanceOf.js#L19-L36In the ESM build, which is used by webpack by following the
module
field in package.json, the file gets compiled to a.mjs
file, which does not get applied the webpackProvidePlugin
, see webpack/webpack#7032.This makes it impossible to bundle
graphiql
with webpack.Also reported to
graphql-js
at graphql/graphql-js#1536, but filing here for visibility.The text was updated successfully, but these errors were encountered: