-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby): Handle duplicated fragment definitions #15179
Conversation
Played a bit with this idea:
This would require restricting queries to packages that include |
000d56e
to
9abdcf9
Compare
9abdcf9
to
2069383
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌮
Now that we run babel-loader for all dependencies after #14111, we should finally be able to support queries in dependencies!
This pull request adds
node_modules
as one of the folders to parse through. There are a couple of things to consider here though:Parsing through everything causes a
GraphQL Error: RelayParser: Encountered duplicate defintitions for one or more documents: each document must have a unique name
because ofGatsbyImageSharpFixed
etc (assuming these are coming fromgatsby-plugin-sharp
) My quick fix for this was filtering out any paths that contain/gatsby/
but of course we can't do that. How should we filter these out?This significantly slows down the
extract queries from components
phase since it now has to parse ~18000 files compared to like 10 before. One way to speed this up would be to filter deps by only ones that havegatsby
as a dep or peer dep (since they would need thegraphql
export fromgatsby
to query)Thoughts?
Todo
How do I test this?
Install
gatsby-seo
from npm (our SEO component extracted to a separate package) and use as a dependency.Edit
We've reverted the addition to parsing
node_modules
because it depends on some other follow up work by @wardpeet. This PR just handles fragment duplication for now.