Closed ximbong closed 4 years ago
An error occurred when trying to polyfill IntersectionObserver as in the documentation.
An answer in this issue, with async function and await import fixed this. I'm not sure if this is anyhow environment related.
async
await
System: OS: macOS 10.14.6 CPU: (4) x64 Intel(R) Core(TM) i7-6567U CPU @ 3.30GHz Shell: 5.3 - /bin/zsh Binaries: Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node Yarn: 1.21.1 - ~/.yvm/shim/yarn npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm Languages: Python: 2.7.16 - /usr/bin/python Browsers: Chrome: 79.0.3945.117 Firefox: 69.0 Safari: 13.0.4 npmPackages: gatsby: ^2.13.3 => 2.18.18 gatsby-background-image: ^0.9.6 => 0.9.12 gatsby-image: ^2.2.33 => 2.2.37 gatsby-plugin-emotion: ^4.1.1 => 4.1.18 gatsby-plugin-layout: ^1.1.21 => 1.1.21 gatsby-plugin-manifest: ^2.2.1 => 2.2.34 gatsby-plugin-offline: ^2.2.1 => 2.2.10 gatsby-plugin-react-helmet: ^3.1.0 => 3.1.18 gatsby-plugin-robots-txt: ^1.5.0 => 1.5.0 gatsby-plugin-sitemap: ^2.2.25 => 2.2.25 gatsby-plugin-typescript: ^2.1.0 => 2.1.23 gatsby-source-contentful: ^2.1.6 => 2.1.73
gastby-browser.js:
gastby-browser.js
export const onClientEntry = () => { // IntersectionObserver polyfill for gatsby-background-image (Safari, IE) if (!(`IntersectionObserver` in window)) { import(`intersection-observer`) console.log(`# IntersectionObserver is polyfilled!`) } }
Closing this issue, as this I just found out it's ESlint related! no-unused-expressions
no-unused-expressions
indeed this did the trick for me
Summary
An error occurred when trying to polyfill IntersectionObserver as in the documentation.
Relevant information
An answer in this issue, with
async
function andawait
import fixed this. I'm not sure if this is anyhow environment related.Environment (if relevant)
File contents (as in the documentation)
gastby-browser.js
: