mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 17:23:22 +01:00
IntersectionObserver polyfill
This commit is contained in:
parent
fdd6428bb8
commit
3ae7c447c2
@ -1,3 +1,11 @@
|
|||||||
exports.onInitialClientRender = () => {
|
exports.onInitialClientRender = () => {
|
||||||
require('./src/styles/base.scss')
|
require('./src/styles/base.scss')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.onClientEntry = () => {
|
||||||
|
// IntersectionObserver polyfill for gatsby-image (Safari, IE)
|
||||||
|
if (typeof window.IntersectionObserver === 'undefined') {
|
||||||
|
require('intersection-observer')
|
||||||
|
console.log('👍 IntersectionObserver is polyfilled') // eslint-disable-line no-console
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -3,22 +3,22 @@ const path = require('path')
|
|||||||
// Intersection Observer polyfill
|
// Intersection Observer polyfill
|
||||||
// requires `npm install intersection-observer`
|
// requires `npm install intersection-observer`
|
||||||
// https://github.com/gatsbyjs/gatsby/issues/2288#issuecomment-334467821
|
// https://github.com/gatsbyjs/gatsby/issues/2288#issuecomment-334467821
|
||||||
exports.onCreateWebpackConfig = ({ actions, loaders, stage }) => {
|
// exports.onCreateWebpackConfig = ({ actions, loaders, stage }) => {
|
||||||
const { setWebpackConfig } = actions
|
// const { setWebpackConfig } = actions
|
||||||
|
|
||||||
if (stage === 'build-html') {
|
// if (stage === 'build-html') {
|
||||||
const nullRule = {
|
// const nullRule = {
|
||||||
test: /intersection-observer/,
|
// test: /intersection-observer/,
|
||||||
use: [loaders.null()]
|
// use: [loaders.null()]
|
||||||
}
|
// }
|
||||||
|
|
||||||
setWebpackConfig({
|
// setWebpackConfig({
|
||||||
module: {
|
// module: {
|
||||||
rules: [nullRule]
|
// rules: [nullRule]
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create project pages from projects.yml
|
// Create project pages from projects.yml
|
||||||
|
Loading…
Reference in New Issue
Block a user