GithubHelp home page GithubHelp logo

birkir / gatsby-source-graphql-universal Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 19.0 2.9 MB

Plugin for connecting arbitrary GraphQL APIs to Gatsby GraphQL with client side execution

JavaScript 80.20% CSS 15.11% Shell 0.96% TypeScript 3.74%

gatsby-source-graphql-universal's People

Contributors

birkir avatar gforro avatar laradevitt avatar marcmcintosh avatar veloce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gatsby-source-graphql-universal's Issues

Example not working with latest version of gatsby

I was trying to verify this plugin works with latest version of gatsby-source-graphql that uses graphql-tools-fork instead of graphql-tools.

I couldn't get the example working, however, looks like passing along query hash instead of query.

Any guidance?

Multiple versions of graphql

Problem

I'm not sure how this came up, I started getting the error below on my projects that depend on gatsby-source-prismic-graphql.

 ERROR #11321  PLUGIN

"gatsby-source-prismic-graphql" threw an error while running the sourceNodes lifecycle:

Cannot use GraphQLDirective "@include" from another module or realm.

Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.

https://yarnpkg.com/en/docs/selective-version-resolutions

Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.

  78 |       if (!sdl) {
  79 |         introspectionSchema = yield introspectSchema(link);
> 80 |         sdl = printSchema(introspectionSchema);
     |               ^
  81 |       } else {
  82 |         introspectionSchema = buildSchema(sdl);
  83 |       }

File: ..\..\node_modules\gatsby-source-graphql-universal\gatsby-node.js:80:15

This indicates multiple versions of graphql which is obviously not allowed.

A couple of other issues posted in the last few days:

birkir/gatsby-source-prismic-graphql#176
gatsbyjs/gatsby#22645

Output of yarn why graphql:

$ yarn why graphql
yarn why v1.22.4
[1/4] Why do we have the module "graphql"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "[email protected]"
info Has been hoisted to "graphql"
info Reasons this module exists
   - "workspace-aggregator-b6900ab3-b030-4197-a37e-fa5763949305" depends on it
   - Hoisted from "_project_#gatsby-theme-prismic-blog#gatsby#graphql"
   - Hoisted from "_project_#gatsby-theme-prismic-core#gatsby-source-prismic-graphql#gatsby-source-graphql#graphql"
info Disk size without dependencies: "3.06MB"
info Disk size with unique dependencies: "3.16MB"
info Disk size with transitive dependencies: "3.16MB"
info Number of shared dependencies: 1
=> Found "gatsby-source-graphql-universal#[email protected]"
info This module exists because "_project_#gatsby-theme-prismic-core#gatsby-source-prismic-graphql#gatsby-source-graphql-universal" depends on it.
info Disk size without dependencies: "3.18MB"
info Disk size with unique dependencies: "3.18MB"
info Disk size with transitive dependencies: "3.18MB"
info Number of shared dependencies: 0
=> Found "@types/graphql#[email protected]"
info This module exists because "_project_#gatsby-theme-prismic-core#gatsby-source-prismic-graphql#gatsby-source-graphql-universal#@types#graphql" depends on it.
info Disk size without dependencies: "3.18MB"
info Disk size with unique dependencies: "3.18MB"
info Disk size with transitive dependencies: "3.18MB"
info Number of shared dependencies: 0
Done in 1.19s.

Looking at the source for the latest version of this package (3.1.11) in node_modules/ (which, weirdly, doesn't appear to be in sync with this repo), the given version for graphql is "*" which seems wrong?

Workaround

My workaround is to delete node_modules/ and yarn.lock, then add a resolution to package.json in the project root (or workspaces root if that is your set-up):

  "resolutions": {
    "graphql": "^14.6.0"
  }

Then reinstall with yarn.

Thanks -

Edit: Expanding on workaround.

useStaticQuery is broken

Title says it all really, Common problem with the approach of patching babel-plugin-remove-graphql-queries.

Screenshot 2020-06-20 at 10 45 26

Babel loader broken.

The most recent changes from this PR (gatsbyjs/gatsby#15875) seem to have broken the babel-loader and it is not throwing the following errors:

TypeError: Cannot read property 'plugins' of undefined
    at prepareOptions (.../node_modules/gatsby/dist/utils/babel-loader-helpers.js:62:35)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.