I would like to add data to gatbsy-config in order to use GraphQL to manage the data.
so I copied the gatbsy-config.js :
module.exports = {
siteMetadata: {
title: `Gatsby Default Starter`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@gatsbyjs`,
},
}
and I replaced the siteMetadata
with my data, and all work fine.
But I would like to use an json, or any file to store the data, and not put in the config directly, so I tried :
import data fron 'src/data/myData.json'
module.exports = {
siteMetadata: {
data: data
},
}
but I get an error on the first like
import projects from 'src/data/myData.json';
^^^^^^^^
SyntaxError: Unexpected identifier
So it looks like I can't use import. Is there a way to achieve this ?