-
Notifications
You must be signed in to change notification settings - Fork 787
graphql import broken in Next.js since v2.1.0-alpha.1 #1591
Comments
Potentially related? #1590 |
ME TOO |
I got this too. |
This is not Next.js specific. Running the following in node also fails: const apollo = require('react-apollo');
console.log(apollo.graphql); // logs "undefined" I've got this happening in |
next.js transpilation:
react-apollo/index.js "use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./browser"));
var renderToStringWithData_1 = require("./renderToStringWithData");
exports.renderToStringWithData = renderToStringWithData_1.renderToStringWithData;
//# sourceMappingURL=index.js.map react-apollo/index.mjs
package.json
// fails
import {graphql} from 'react-apollo/index.js'
import {graphql} from 'react-apollo/index'
// fails too (i thought this worked but it doesn't)
import {graphql} from 'react-apollo/index.mjs'
Okay so The workaround is to make it us the Clear your You need
EDIT: Changed from json5 to json format. @pantharshit00 Hopefully its fixed soon though. |
Thanks for the workaround Copy and paste ninjas there is a syntax error in the babelrc snippet so paste this snippet instead. Above one has "plugins": [
[
"module-resolver",
{
"alias": {
"^react-apollo$": "react-apollo/index"
}
}
]
] Thanks again @vjpr I hope the apollo team get this working soon so that I may eliminate babel plugin in future . |
hm. implementing the fix in post above creates all kinds of errors w/ anyone else hitting this? error:
|
@brandonmp @vjpr This is now fixed in next js. https://github.com/zeit/next.js/releases/tag/5.0.1-canary.2 |
I've tried the posted workaround and I still get this error:
Anyone have some insight to what is happening? |
@wesbos Hi I am one of your happy customers. I too got those errors. Stable react Apollo is compatible with next. Your next version should be higher than next 5.0.1-canary2 . That fixes this message. I recommend the newly launched 5.1 And react Apollo version should be 2.1 or higher not any beta version. This is a new project using both https://github.com/JesseRWeigel/javascript-af |
@pantharshit00 thank you - I tried upgrading to Next 5.1 and the error persists :( - so I'm not sure if we had the same errors |
pretty sure this can be closed |
I'm pretty sure this was solved in July. If not ping me and I'll reopen. |
Importing
graphql
in a component in a Next.js project works in v2.1.0-alpha.0 but causes errors for all newer alpha and beta versions.I'm unsure if this is special to Next.js or if it is simply an issue for all Webpack users.
The text was updated successfully, but these errors were encountered: