-
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
ImageSharp nodes cannot be created by other plugins #11092
Comments
Can you try what @pieh mentions in this comment?
|
@sidharthachatterjee Many thanks for answering this question :-) This update to the demo project incorporates your suggestion - and it appears to build the graph accordingly. The allImageSharp {
edges {
node {
fixed {
width
height
src
}
}
}
} The YAML query also returns sensible data: featureYaml {
id
feature {
description
image
}
fields {
hard_coded_image_name
}
} The bit I don't get is how to apply the featureYaml {
id
feature {
description
image
}
fields {
hard_coded_image_name {
childImageSharp {
fluid(maxWidth: 400, maxHeight: 250) {
...GatsbyImageSharpFluid
}
}
}
}
} |
By invoking the fluid API I was able to add the ImageSharp (dynamically) statically to the export const query = graphql`
query FeatureQuery {
allFeature {
totalCount
edges {
node {
id
description
fluid {
src
}
}
}
}
}
` |
This approach also supports the However, I still haven't figured out how to propagate a query such as resize via graphql e.g. allFeature {
edges {
node {
id
description
fluid {
... on ImageSharp {
resize(width: 150, height: 150, grayscale: true) {
src
}
}
}
}
}
} This seems to be because I invoked the During |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m Thanks again for being part of the Gatsby community! |
Description
ImageSharp
nodes cannot be created by other plugins:Steps to reproduce
This minimal POC project is based of the Hello World starter and reproduces the symptom:
gatsby-transformer-yaml
to process YAML - this emulates the process of creating a resource node dynamicallyonCreateNode
creates:type
attribute of the image node is set toImageSharp
so that this will get processed bygatsby-transformer-sharp
The relevant
onCreateNode
code is here.Expected result
To create an
ImageSharp
node that references the image declared by the YAML data. The motivation ultimately to be able to construct pages from data descriptor files, similar to thegatsby-transformer-remark
flow, but with a custom input language instead of markdown.This issue has a similar motivation to #6112
Actual result
The node object passed to "createNode":
The plugin creating the node:
Environment
The text was updated successfully, but these errors were encountered: