text: const path = require('path')
  const { createFilePath } = require('gatsby-source-filesystem')
  
  exports.onCreateNode = ({ node, getNode, actions }) => {
    const { createNodeField } = actions
    if (node.internal.type === 'MarkdownRemark') {
      const slug = createFilePath({ node, getNode, basePath: 'posts'})
      createNodeField({
        node,
        name: 'slug',
        value: slug
      })
    }
  }
  
  exports.createPages = ({ graphql, actions }) => {
    const { createPage } = actions
    return graphql(`
      {
        allMarkdownRemark {
          edges {
            node {
              fields {
                slug
              }
            }
          }
        }
      }
    `
    ).then(result => {
      result.data.allMarkdownRemark.edges.forEach(({ node }) => {
        createPage({
          path: node.fields.slug,
          component: path.resolve('./src/templates/blog.js'),
          context: {
            slug: node.fields.slug,
          },
        })
      })
    })
  }
  
  exports.onCreateWebpackConfig = ({ config, stage, loaders, actions }) => {
    if (stage === 'build-html') {
      actions.setWebpackConfig({
        module: {
          rules: [
            {
              test: /react-tetris/,
              use: loaders.null(),
            },
          ],
        },
      })
    }
    if (stage === 'develop') {
      config.devServer = {
        hot: false, 
        inline: false
      }
    }
    return config 
  }
  