After migration on v2 I got errors while trying to request content of JSON files. Is it a bug or I should work with it somehow another way?
gatsby-config.js:
plugins: [
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/templates`,
name: 'pages',
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/locale`,
name: 'locale',
},
},
'gatsby-plugin-lodash',
'gatsby-plugin-styled-components',
'gatsby-plugin-sass',
'gatsby-plugin-react-helmet',
'gatsby-plugin-sharp',
'gatsby-transformer-json',
'gatsby-transformer-sharp',
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [],
},
},
],
package.json:
"dependencies": {
"babel-plugin-styled-components": "^1.5.1",
"gatsby": "next",
"gatsby-image": "next",
"gatsby-plugin-lodash": "next",
"gatsby-plugin-react-helmet": "next",
"gatsby-plugin-sass": "next",
"gatsby-plugin-sharp": "next",
"gatsby-plugin-styled-components": "next",
"gatsby-remark-images": "next",
"gatsby-source-filesystem": "next",
"gatsby-transformer-json": "next",
"gatsby-transformer-remark": "next",
"gatsby-transformer-sharp": "next",
"lodash": "^4.17.5",
"node-sass": "^4.9.0",
"normalize.css": "^8.0.0",
"prop-types": "^15.6.1",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-helmet": "^5.2.0",
"styled-components": "^3.3.2",
"uuid": "^3.2.1"
},
In gatsby-node.js I use following request:
`
{
allLocaleJson {
edges {
node {
fields {
slug
}
pages {
title
}
}
}
}
}
`
but there is a error:

But if I comment in gatsby-node.js all GraphQL queries, I can see all edges on GraphiQL including
allLocaleJson.
Hmm maybe this is related to https://github.com/gatsbyjs/gatsby/issues/5980? @oobidin are you able to link to a repo that reproduces this problem?
I have the same problem. I created a small repo which reproduces the errors on my Windows 10 and Ubuntu 18.04 LTS systems here. See the README for more info.
@MichaelZoerner thanks! I didn't have enough time for it.
@oobidin you are welcome, I just want to see this problem solved too.
I investigated a bit further. It seems that multiple instances of gatsby-source-filesystem shouldn't be used.
So, this produces problems like mentioned above:
``module.exports = {
/* ... */
plugins: [
{
resolve:gatsby-source-filesystem,
options: {
name:md,
path:${__dirname}/src/filesrc/md,
},
},
{
resolve:gatsby-source-filesystem,
options: {
name:data,
path:${__dirname}/src/filesrc/data`,
},
},
],
};
The workaround for me is using a common root directory:
```module.exports = {
/* ... */
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
name: `filesrc`,
path: `${__dirname}/src/filesrc`,
},
},
],
};
This works - at least for me.
HTH
This https://github.com/gatsbyjs/gatsby/pull/6044 should fix this issue
Most helpful comment
This https://github.com/gatsbyjs/gatsby/pull/6044 should fix this issue