text: require("dotenv").config({
    path: `.env.${process.env.NODE_ENV}`,
  });
  
  const contentfulConfig = {
    spaceId: process.env.CONTENTFUL_SPACE_ID,
    accessToken:
      process.env.CONTENTFUL_ACCESS_TOKEN ||
      process.env.CONTENTFUL_DELIVERY_TOKEN,
  };
  
  const { spaceId, accessToken } = contentfulConfig;
  
  if (!spaceId || !accessToken) {
    throw new Error(
      "Contentful spaceId and the access token need to be provided."
    );
  }
  
  module.exports = {
    siteMetadata: {
      title: "TDW - MP1",
      description: "TDW - MP1",
    },
    pathPrefix: "/",
    plugins: [
      "gatsby-transformer-remark",
      "gatsby-transformer-sharp",
      "gatsby-plugin-react-helmet",
      "gatsby-plugin-sharp",
      "gatsby-plugin-image",
      "gatsby-plugin-netlify",
      {
        resolve: "gatsby-source-contentful",
        options: contentfulConfig,
      },
    ],
  };
  