diff --git a/gatsby-node.js b/gatsby-node.js index df4ed4d..46ba0a0 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -14,6 +14,16 @@ exports.modifyWebpackConfig = ({ config, stage }) => { return config } +// https://github.com/gatsbyjs/gatsby/issues/2288#issuecomment-334467821 +exports.modifyWebpackConfig = ({ config, stage }) => { + if (stage === 'build-html') { + config.loader('null', { + test: /intersection-observer/, + loader: 'null-loader', + }) + } +} + exports.createPages = ({ boundActionCreators, graphql }) => { const { createPage } = boundActionCreators diff --git a/package.json b/package.json index ae9122b..647fdeb 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "gatsby-source-filesystem": "^1.5.35", "gatsby-transformer-json": "^1.0.17", "gatsby-transformer-sharp": "^1.6.24", + "intersection-observer": "^0.5.0", "react-helmet": "^5.2.0", "react-markdown": "^3.3.0", "react-transition-group": "^2.3.1" diff --git a/src/components/atoms/ProjectImage.jsx b/src/components/atoms/ProjectImage.jsx index 0c9d7e3..8a83c34 100644 --- a/src/components/atoms/ProjectImage.jsx +++ b/src/components/atoms/ProjectImage.jsx @@ -1,6 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' import Img from 'gatsby-image' +import 'intersection-observer' import './ProjectImage.scss' const ProjectImage = ({ sizes, alt }) => (