Closed English3000 closed 6 years ago
Update: I got my app to render by commenting out my entire environment.js
// import { createFetcher, createSubscriber } from "@absinthe/socket-relay";
// import { Environment, Network, RecordSource, Store } from "relay-runtime";
// import absintheSocket from "./absinthe";
//
// export default new Environment({ network: Network.create( createFetcher(absintheSocket),
// createSubscriber(absintheSocket) ),
// store: new Store(new RecordSource()) });
Also, react-router-native
has the same issue. From what I've gleaned through searches, the issue may have to do with Babel 6 not transpiling the export
statements nested within functions..?
Regardless, I still need a fix so I can use createFetcher
and createSubscriber
Tried
const createFetcher = require("@absinthe/socket-relay").createFetcher;
const createSubscriber = require("@absinthe/socket-relay").createSubscriber;
Doesn't work
This is also an issue with react-router-native
. I think what's causing the bug is the use of export {...} from ...
In Google Chrome, the error (for this exact same issue) is
Uncaught SyntaxError: Unexpected token export
To the best of my knowledge, this issue is being caused by how babel-brunch
compiles your /src/index.js
I have opened an issue with them: https://github.com/babel/babel-brunch/issues/66
I guess the issue you are experiencing is because of this line, it should point to "compat/cjs/index.js"
as the other packages...
Don't you mind trying to import from @absinthe/socket-relay/compat/cjs
, and tell me how it went?
IT WORKED!!!!!
Great @English3000!
I will add this to the tasks I need to acomplish for the next release, thanks for having taken the time to report this!
Happy coding!
Repo
Literally copied & pasted
environment.js
&absinthe.js
code from "Craft GraphQL APIs in Elixir with Absinthe" source code.In the book, they put the frontend in a separate repo.