Comments (12)
Odd, that code doesn't appear in this package - what's the stack trace?
from persistgraphql.
[1] .../GitHunt-React/server_bundle.js:98859
[1] import 'whatwg-fetch';
[1] ^^^^^^
[1] SyntaxError: Unexpected token import
[1] at Object.exports.runInThisContext (vm.js:78:16)
[1] at Module._compile (module.js:543:28)
[1] at Object.Module._extensions..js (module.js:580:10)
[1] at Module.load (module.js:488:32)
[1] at tryModuleLoad (module.js:447:12)
[1] at Function.Module._load (module.js:439:3)
[1] at Module.runMain (module.js:605:10)
[1] at run (bootstrap_node.js:420:7)
[1] at startup (bootstrap_node.js:139:9)
[1] at bootstrap_node.js:535:3
Got this just by updating apollo-client on GitHunt-React.
from persistgraphql.
Ah. We briefly removed the whatwg-fetch
polyfill within Apollo Client. I'm not sure what that has to do with this tool but could you try updating to the latest AC?
from persistgraphql.
Tried v0.8.1, same thing.
I get the same problem when I try to follow https://github.com/apollostack/GitHunt-React/pull/176/files when I add to my project:
import { PersistedQueryNetworkInterface } from 'extractgql/lib/browser'
I guess whatwg-fetch
is not the problem here, but it has something to do with import
, webpack
and ssr
, will try to figure out what I'm doing wrong.
from persistgraphql.
Hi,
Did you find a solution ?
I use Meteor and I had the same problem when trying to import PersistedQueryNetworkInterface
, the issue seems to come from https://github.com/apollographql/apollo-client/blob/master/src/transport/networkInterface.ts#L1, it seems to be a ES6 compatibility issue, coming from one of the build tool (I did not find a (clean) solution though).
As I only wanted to test this package, what I did (hacky) was to change var networkInterface_1 = require("apollo-client/transport/networkInterface");
to var networkInterface_1 = require("apollo-client");
in the generated ApolloNetworkInterface.js
I believe that #9 would solve this issue as Request
is exported by apollo-client/index.js
as opposed to QueryAndOptions
ex0ns
from persistgraphql.
Hi,
Current GitHunt-React and GitHunt-API examples still do not work for me, if I update 'apollo-client'.
Will wait for #9 to get merged and try again.
But was able to get it working with 0.6.0, by updating 'persistgraphql' to 0.2.10.
from persistgraphql.
Yes,
I wonder if this is not a module issue between apollo-client which uses es2015 import and and persistgraphql which is based on commonJS imports.
I noticed that changing 'apollo-client' to 0.8.1 in devDependencies generates
import 'whatwg-fetch';
import { print } from 'graphql-tag/printer';
export function printRequest(request) {
in node_modules/apollo-client/transport/networkInterface.js
Whereas 'apollo-client' 0.6 generates
require("whatwg-fetch");
var printer_1 = require("graphql-tag/printer");
function printRequest(request) {
I don't know where this come from (probably related to apollo-client) but, I think that there is definitely an issue with version of apollo-client (see apollographql/apollo-client@4f76c57#diff-e5e546dd2eb0351f813d63d1b39dbc48)
ex0ns
from persistgraphql.
I think that there is an issue with the compiled file /apollo-client/transport/networkInterface.js
- is that okay that import ...
is in use? I think is should be require(...)
.
As a temporary workaround, add this to your Webpack loaders config:
{
test: /node_modules\/apollo-client\/transport\/networkInterface\.js$/,
loader: 'babel'
},
from persistgraphql.
Should I raise an issue in "apollo-client"?
from persistgraphql.
@mitjade I am not sure it related directly to apollo-client, since import ...
is valid ES6 imports syntax.
Maybe it can be solved if using Webpack and Babel config with es6 imports.
from persistgraphql.
The actual error is thrown because this package imports from inner files of apollo-client/.../..
(https://github.com/apollographql/persistgraphql/blob/master/src/network_interface/ApolloNetworkInterface.ts#L5) instead of loading those from the main package apollo-client
.
from persistgraphql.
Those imports can now be removed because I believe Apollo Client now exports those from the main package.
from persistgraphql.
Related Issues (20)
- Maximum call stack error when using cloneDeep in query transformer
- [Idea] replace json property names with ordinals to reduce bandwidth HOT 4
- Must provide a query error when use with graphql-subscription
- Mixing .graphql files with tagged template literals HOT 1
- Server and client sync
- Can it be used with Relay Modern? HOT 2
- can't install on Windows HOT 2
- [BUG] persistgraphql serializes *differently* from apollo client, breaking the whitelist HOT 1
- Register query manually
- Support glob syntax [feature request]
- [BUG] template strings within attributes not parsed correctly
- How should we namespace open source queryTransformers? HOT 7
- Hapi17 Example
- Relax dependency requirements HOT 5
- Does not recognize .gql file extension HOT 1
- Commented out query causes syntax error during javascript extraction
- Queries from both external graphql files and JS extraction aren't output together
- This tool can only generate 1 query when scan a directory that contains multiple ".graphql" files HOT 2
- Add / enable Travis CI
- Support babel compiled AST.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from persistgraphql.