mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 09:13:19 +01:00
IntersectionObserver polyfill
This commit is contained in:
parent
fdd6428bb8
commit
3ae7c447c2
@ -1,3 +1,11 @@
|
||||
exports.onInitialClientRender = () => {
|
||||
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
|
||||
// requires `npm install intersection-observer`
|
||||
// https://github.com/gatsbyjs/gatsby/issues/2288#issuecomment-334467821
|
||||
exports.onCreateWebpackConfig = ({ actions, loaders, stage }) => {
|
||||
const { setWebpackConfig } = actions
|
||||
// exports.onCreateWebpackConfig = ({ actions, loaders, stage }) => {
|
||||
// const { setWebpackConfig } = actions
|
||||
|
||||
if (stage === 'build-html') {
|
||||
const nullRule = {
|
||||
test: /intersection-observer/,
|
||||
use: [loaders.null()]
|
||||
}
|
||||
// if (stage === 'build-html') {
|
||||
// const nullRule = {
|
||||
// test: /intersection-observer/,
|
||||
// use: [loaders.null()]
|
||||
// }
|
||||
|
||||
setWebpackConfig({
|
||||
module: {
|
||||
rules: [nullRule]
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
// setWebpackConfig({
|
||||
// module: {
|
||||
// rules: [nullRule]
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
// Create project pages from projects.yml
|
||||
|
Loading…
Reference in New Issue
Block a user