From 8f8b26d5ebd9d9463c5981778d3eb9cc5e71cca1 Mon Sep 17 00:00:00 2001 From: Pedro Costa Date: Thu, 4 Apr 2019 18:56:32 +0100 Subject: [PATCH] Attempt to add the IntersectionObserver polyfill Why: * The site is not working in Safari, missing the IntersectionObserver polyfill, which we are apparently not importing correctly. This change addresses the issue by: * Implementing the configuration suggested in https://github.com/gatsbyjs/gatsby/issues/10435#issuecomment-446627549 --- gatsby-browser.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gatsby-browser.js b/gatsby-browser.js index d523cbd9..ac20eaaa 100644 --- a/gatsby-browser.js +++ b/gatsby-browser.js @@ -4,6 +4,8 @@ * See: https://www.gatsbyjs.org/docs/browser-apis/ */ -exports.onInitialClientRender = () => { - require("intersection-observer") +export const onClientEntry = async () => { + if (typeof IntersectionObserver === "undefined") { + await import("intersection-observer") + } }