text: const Promise = require('bluebird')
  const path = require('path')
  
  exports.modifyWebpackConfig = ({ config, stage }) => {
      if (stage === "build-html") {
          config.loader("null",
          {
              test: /isotope\-|fizzy\-ui\-utils|desandro\-|masonry|outlayer|get\-size|doc\-ready|eventie|eventemitter|react-mapbox-gl|react-mapbox-gl|react-map-gl|(mapbox-gl)\.js$/,
              loader: "null-loader",
          },
      );
      }
  };
  
  exports.createPages = ({ graphql, boundActionCreators }) => {
    const { createPage } = boundActionCreators
  
    return new Promise((resolve, reject) => {
      const blogPost = path.resolve('./src/templates/blog-post.js')
      resolve(
        graphql(
          `
            {
              allContentfulBlogPost {
                edges {
                  node {
                    title
                    slug
                  }
                }
              }
            }
            `
        ).then(result => {
          if (result.errors) {
            console.log(result.errors)
            reject(result.errors)
          }
  
          const posts = result.data.allContentfulBlogPost.edges
          posts.forEach((post, index) => {
            createPage({
              path: `/blog/${post.node.slug}/`,
              component: blogPost,
              context: {
                slug: post.node.slug
              },
            })
          })
        })
      )
    })
  }
  