prismicio / gatsby-source-prismic-graphql

Gatsby source plugin for Prismic GraphQL
MIT License
17 stars 14 forks source link

StaticQuery not working #22

Closed imthejungler closed 4 years ago

imthejungler commented 4 years ago

Hi prismic team,

I'm having problems with this tutorial: https://prismic.io/docs/gatsby/getting-started-tutorials/getting-started-tutorials

I'm having errors when running npm start. I followed the instructions in the page and I was having the following error:

 Error: Cannot find module './third-party/gatsby-node'
  Require stack:
  - /home/projects/poc/prismicio-gatsby-poc/node_modules/gatsby-source-graphql-universal/gatsby-node.js
  - /home/projects/poc/prismicio-gatsby-poc/node_modules/gatsby-source-prismic-graphql/gatsby-node.js
  - /home/projects/poc/prismicio-gatsby-poc/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js
  - /home/projects/poc/prismicio-gatsby-poc/node_modules/gatsby/dist/bootstrap/load-plugins/validate.js
  - /home/projects/poc/prismicio-gatsby-poc/node_modules/gatsby/dist/bootstrap/load-plugins/load.js
  - /home/projects/poc/prismicio-gatsby-poc/node_modules/gatsby/dist/bootstrap/load-plugins/index.js
  - /home/projects/poc/prismicio-gatsby-poc/node_modules/gatsby/dist/services/initialize.js
  - /home/projects/poc/prismicio-gatsby-poc/node_modules/gatsby/dist/services/index.js
  - /home/projects/poc/prismicio-gatsby-poc/node_modules/gatsby/dist/commands/develop-process.js
  - /home/projects/poc/prismicio-gatsby-poc/.cache/tmp-13239-svmd0sEUwBWJ

I manage to get rid of the error by doing:

  "resolutions": {
    "gatsby-source-graphql-universal": "3.3.0"
  }

In the package.json. (I'm using yarn) I did a test installing a fresh gatsby site and your plugin and fails the same way.

With that out of the way I realized that the StaticQuery is not functioning properly, showing me: StaticQuery(Loading) at the top of the page.

Doing some research I found out this issue https://github.com/gatsbyjs/gatsby/issues/24890

Going through your getting started documentation I found that you use a different babel-plugin-remove-graphql-queries, and a comment I read in the above issue rang a bell. (https://github.com/gatsbyjs/gatsby/issues/24890#issuecomment-641509113), maybe the fact that you're using a different babel plugin has something to do. and maybe is also related with having to do the resolutions part?

I haven't been able to fix this and is impeding the development of my page.

I'm using: yarn v1.22.4 Node.js v12.18.2. npm 6.14.6

Thx and regards,

imthejungler commented 4 years ago

This issue is related: https://github.com/birkir/gatsby-source-graphql-universal/issues/19

imthejungler commented 4 years ago

Yeah, my fault.

I'm kinda new in this npm/gatsby/plugins thing. I got confused. I think the README.md could be modified to say to use yarn add @prismicio/gatsby-source-prismic-graphql for thouse of us that get directly from your tutorial and doesn't know that this is a fork.