-
Notifications
You must be signed in to change notification settings - Fork 27k
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
next@7 + graphql@0.13.2 prevent React from initialize #5233
Comments
It was fixed for me when i updated to graphql 14.0.2 Also in this template it appears that there's a wrong import in components/PostList.js Try to replace |
Thanks @immortalx for the tip with version 14.0.2, I added it as a workaround to the description. Since many packages still rely on |
I guess this issue should be filed against webpack, we just use the default webpack configuration in resolving .mjs |
This can be solved by including
in your webpack rules -- as well as making sure the
|
This is fixed on canary. |
Bug report
Describe the bug
next@7 prevent React from initialize in the browser if using graphql@0.13.2, but SSR is working fine.
This error prevents React from initializing and thus no interaction with the webpage is possible.
The following error is shown in the console:
Error was not caught ReferenceError: "require is not defined"
Error was not caught ReferenceError: "require is not defined" mjshttp://localhost:3030/_next/static/development/pages/_app.js:15485:1__webpack_require__http://localhost:3030/_next/static/runtime/webpack.js:790:13fnhttp://localhost:3030/_next/static/runtime/webpack.js:151:20mjshttp://localhost:3030/_next/static/development/pages/_app.js:19496:77__webpack_require__http://localhost:3030/_next/static/runtime/webpack.js:790:13fnhttp://localhost:3030/_next/static/runtime/webpack.js:151:20mjshttp://localhost:3030/_next/static/development/pages/_app.js:21542:69__webpack_require__http://localhost:3030/_next/static/runtime/webpack.js:790:13fnhttp://localhost:3030/_next/static/runtime/webpack.js:151:20mjshttp://localhost:3030/_next/static/development/pages/_app.js:14900:72__webpack_require__http://localhost:3030/_next/static/runtime/webpack.js:790:13fnhttp://localhost:3030/_next/static/runtime/webpack.js:151:20mjshttp://localhost:3030/_next/static/development/pages/_app.js:15020:66__webpack_require__http://localhost:3030/_next/static/runtime/webpack.js:790:13fnhttp://localhost:3030/_next/static/runtime/webpack.js:151:20jshttp://localhost:3030/_next/static/development/pages/_app.js:5523:65__webpack_require__http://localhost:3030/_next/static/runtime/webpack.js:790:13fnhttp://localhost:3030/_next/static/runtime/webpack.js:151:20jshttp://localhost:3030/_next/static/development/pages/_app.js:5392:64__webpack_require__http://localhost:3030/_next/static/runtime/webpack.js:790:13fnhttp://localhost:3030/_next/static/runtime/webpack.js:151:20jshttp://localhost:3030/_next/static/development/pages/_app.js:1143:75__webpack_require__http://localhost:3030/_next/static/runtime/webpack.js:790:13fnhttp://localhost:3030/_next/static/runtime/webpack.js:151:20jshttp://localhost:3030/_next/static/development/pages/_app.js:13:70jshttp://localhost:3030/_next/static/development/pages/_app.js:12:29__webpack_require__http://localhost:3030/_next/static/runtime/webpack.js:790:13fnhttp://localhost:3030/_next/static/runtime/webpack.js:151:20jshttp://localhost:3030/_next/static/development/pages/_app.js:71:70jshttp://localhost:3030/_next/static/development/pages/_app.js:67:29__webpack_require__http://localhost:3030/_next/static/runtime/webpack.js:790:13fnhttp://localhost:3030/_next/static/runtime/webpack.js:151:20jshttp://localhost:3030/_next/static/development/pages/_app.js:39236:81jshttp://localhost:3030/_next/static/development/pages/_app.js:39232:29__webpack_require__http://localhost:3030/_next/static/runtime/webpack.js:790:13fnhttp://localhost:3030/_next/static/runtime/webpack.js:151:20[1]/http://localhost:3030/_next/static/development/pages/_app.js:1:3I dug a little bit deeper. It seems like a problem with
*.mjs
files. The error relates to this part of the webpack generated code:`/* WEBPACK VAR INJECTION */}.call(this, require("./../../process/browser.js")))`
I am not very proficient with webpack but it maybe relates to webpack/webpack#7032
To Reproduce
Create a sandbox project with next 7.0.0 and add graphql@0.13.2 as dependency.
Or just pick the with-Apollo example.
ℹ️ Workaround
Upgrade to graphql@14.0.2
Expected behavior
It does not break React.
System information
The text was updated successfully, but these errors were encountered: