text: let contentfulConfig
  
  try {
    // Load the Contentful config from the .contentful.json
    contentfulConfig = require('./.contentful')
  } catch (_) {}
  
  // Overwrite the Contentful config with environment variables if they exist
  contentfulConfig = {
    spaceId: process.env.CONTENTFUL_SPACE_ID || contentfulConfig.spaceId,
    accessToken:
      process.env.CONTENTFUL_ACCESS_TOKEN || contentfulConfig.accessToken,
  }
  
  const { spaceId, accessToken } = contentfulConfig
  
  if (!spaceId || !accessToken) {
    throw new Error(
      'Contentful spaceId and the delivery token need to be provided.'
    )
  }
  
  module.exports = {
    siteMetadata: {
      title: 'Puente Desarrollo Internacional',
      author: 'Chance Murphy',
    },
    pathPrefix: '/gatsby-contentful-starter',
    plugins: [
      `gatsby-plugin-fontawesome-css`,
      `gatsby-plugin-lodash`,
      {
        resolve: `gatsby-plugin-google-analytics`,
        options: {
          trackingId: process.env.GOOGLE_ANALYTICS,
        },
      },
      {
        resolve: `gatsby-plugin-s3`,
        options: {
          bucketName: process.env.S3_BUCKET,
        },
      },
      'gatsby-transformer-remark',
      'gatsby-plugin-react-helmet',
      {
        resolve: `gatsby-source-filesystem`,
        options: {
          name: `images`,
          path: `${__dirname}/src/images`,
        },
      },
      'react-bootstrap',
      `gatsby-transformer-sharp`,
      'gatsby-plugin-sharp',
      'gatsby-plugin-sass',
      {
        resolve: 'gatsby-plugin-i18n',
        options: {
          langKeyDefault: 'en',
          useLangKeyLayout: false
        }
      },
      {
        resolve: 'gatsby-source-contentful',
        options: {
          spaceId: process.env.CONTENTFUL_SPACE_ID,
          accessToken: process.env.CONTENTFUL_ACCESS_TOKEN,
          // contentfulConfig,
        }
      },
      {
        resolve: 'gatsby-plugin-mailchimp',
        options: {
          endpoint: 'https://puente-dr.us18.list-manage.com/subscribe/post?u=a315d09ff9101146e276cb12a&amp;id=af3190932c', // add your MC list endpoint here; see instructions below
        },
      },
    ],
  }
  