Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues on production builds #6

Open
jamesdbruner opened this issue Dec 9, 2020 · 7 comments
Open

Issues on production builds #6

jamesdbruner opened this issue Dec 9, 2020 · 7 comments

Comments

@jamesdbruner
Copy link

Maybe I'm doing something completely wrong but I couldn't get this plugin to work on a test project when I ran gatsby serve so I figured I'd poke around your docs and see if I could get your example working locally and it works fine if you only run gatsby develop but running gatsby build gives me this

ERROR #11321  PLUGIN

"gatsby-plugin-graphql-component" threw an error while running the onPreBuild lifecycle:

ENOENT: no such file or directory, open '/gatsby-plugin-graphql-component/examples/gatsby-plugin-graphql-component-default-example/public/page-data/sq/d/3596933046.json'

I don't get that exact same error on my test project. I get this:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

but I'm not doing anything crazy, just following the docs and I can't run gatsby serve :( Any insight would be much appreciated!

@pristas-peter
Copy link
Owner

Try to check out this issue:
#2

Should be fixed in latest release

@jamesdbruner
Copy link
Author

@pristas-peter I've confirmed this morning that both the docs and my test project are on 0.2.4 which is the latest version, I even went into node_modules and made sure that in my test project the fs.readFile(path.join(directory, `public`, `page-data`, `sq`, `d`, `${value.hash}.json`), `utf-8`) fix is in there.

I also had a coworker pull down this repo and try to run the example and he also got that same error when running yarn build inside your example.

"gatsby-plugin-graphql-component" threw an error while running the onPreBuild lifecycle:

ENOENT: no such file or directory, open '/Users/michaelharvey/Documents/Projects/tests/gatsby-plugin-graphql-component/examples/gatsby-plugin-graphql-component-default-example/public/page-data/sq/d/3596933046.json'

I'm hoping that the issue with your example is the same as the issue with my test project.

@jamesdbruner
Copy link
Author

@pristas-peter Ahhh so I tried updating your examples gatsby version (I just did 2.24.47 because it's what I've been using in other projects) and now your example seems to work as I'd expect.

@jamesdbruner
Copy link
Author

@pristas-peter Sorry to keep blowing up your notifications. I created a reproduction repo for one of the issues I'm having https://github.com/jamesdbruner/graphql-component-test I've laid out the steps to take to reproduce the issue in the readme but essentially it's when I try to serve the component breaks, hard-refreshing fixes it and then refreshing again breaks it. It's very strange.

@pristas-peter
Copy link
Owner

Thanks for the repo, I am a little bit busy this week, but will surely have a look at it.

@jamesdbruner
Copy link
Author

@pristas-peter Any update on this?

@connorhinkson
Copy link

@pristas-peter any fix for this? I'm still getting this error on gatsby build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants