Closed Anahkiasen closed 5 years ago
Thanks! I'll investigate as soon as I have some time.
So! I've finally had some time to investigate this issue, and here's what I found out:
The trace that you gave me is very useful. I was able to reproduce the issue very easily, and the problem is in how gatsby-transformer-json
decides to transform its files. It simply checks for mediaType.
Now, the Gatsby docs are relatively clear on my options. These boil down to:
content
field to the node with the contentloadNodeContent
fieldmediaType
to something else, preferably text/plain
Adding a content
field seems unnecessary, not only because it is not recommended but because the data that we want is already in the data
field. So no to this option.
loadNodeContent
was not well documented, but the source is relatively straight forward to understand. For our purposes, since we have nothing to load, it would basically amount to having the content
field. And so, we do not pick this option.
So, all that to say that I'm just going to change the mediaType
.
gatsby-transformer-json
will ignore this node, everyone is happy, and we can move on with life.
Final, final note: it is possible that someone wants to create their own transformer to the node this plugin creates. When and if such times comes, I will try to provide further assistance and maybe add a loadNodeContent
field. But that seems like overkill. For now.
Thanks for letting me go down an interesting rabbithole @Anahkiasen !
Every time I build my Gatsby app I get this error from the plugin:
The error is inconsequential and has the app builds fine. As far as I could tell, commenting out this line makes the warning go away but I'm not quite sure why it pops up in the first place. :s