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

feat(gatsby): handle graphql-import-node bundling #36951

Merged
merged 1 commit into from
Nov 3, 2022

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Nov 3, 2022

Description

This adds bundling support in case someone is using https://www.npmjs.com/package/graphql-import-node to load queries from .graphql files from within gatsby-node file.

Without this, engine compilation fails as compilation doesn't know how to handle .graphql imports

Related Issues

[ch-56774]

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 3, 2022
@pieh pieh added topic: render-mode Related to Gatsby's different rendering modes and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Nov 3, 2022
@@ -110,6 +110,7 @@
"got": "^11.8.5",
"graphql": "^16.6.0",
"graphql-compose": "^9.0.9",
"graphql-tag": "^2.12.6",
Copy link
Contributor Author

@pieh pieh Nov 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already being installed transitively (codegen deps eventually install it), so it's not adding new dependency and just makes sure package managers install it in a way that can be resolved from within gatsby package

@@ -166,6 +166,12 @@ export async function createGraphqlEngineBundle(
test: /\.txt/,
type: `asset/resource`,
},
{
test: /\.(graphqls?|gqls?)$/,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to match const VALID_EXTENSIONS = ['graphql', 'graphqls', 'gql', 'gqls']; from graphql-import-node package, so it doesn't exactly match instructions for loader ( https://www.npmjs.com/package/graphql-tag#webpack-loading-and-preprocessing )

@LekoArts LekoArts merged commit d5c775a into master Nov 3, 2022
@LekoArts LekoArts deleted the engines/handle-graphql-import-node branch November 3, 2022 13:24
pieh added a commit that referenced this pull request Nov 3, 2022
pieh added a commit that referenced this pull request Nov 3, 2022
(cherry picked from commit d5c775a)

Co-authored-by: Michal Piechowiak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: render-mode Related to Gatsby's different rendering modes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants