Skip to content

Instantly share code, notes, and snippets.

View arijitMondal's full-sized avatar

Arijit arijitMondal

View GitHub Profile
<Head>
<link rel="preconnect" href="https://media.nedigital.sg" />
<link rel="dns-prefetch" href="https://media.nedigital.sg" />
<Head>
<Head>
<link
rel="preload"
href={imageUrl}
as="image"
/>
</Head>
<Head>
<link
rel="preload"
href={imageUrl}
as="image"
imagesrcset={
`${imageUrl} 1200w,
${imageUrl}?w=200 200w,
${imageUrl}?w=400 400w,
${imageUrl}?w=800 800w,
<img
src={`${imageUrl}?q=70`}
srcSet={`${imageUrl}?q=70 1200w,
${imageUrl}?w=200&q=70 200w,
${imageUrl}?w=400&q=70 400w,
${imageUrl}?w=800&q=70 800w,
${imageUrl}?w=1024&q=70 1024w`}
/>
<img
src={imageUrl}
srcSet={
`${imageUrl} 1200w,
${imageUrl}?w=200 200w,
${imageUrl}?w=400 400w,
${imageUrl}?w=800 800w,
${imageUrl}?w=1024 1024w`}
/>
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
module.exports = {
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
if (ANALYZE) {
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: 'server',
analyzerPort: isServer ? 8888 : 8889,
openAnalyzer: true,
if (
typeof window !== 'undefined' &&
'IntersectionObserver' in window &&
'IntersectionObserverEntry' in window &&
'intersectionRatio' in window.IntersectionObserverEntry.prototype
) {
let observer = new IntersectionObserver()
//rest of the code
} else {
import('intersection-observer').then(() => {
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin')
module.exports = {
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
config.plugins.push(new DuplicatePackageCheckerPlugin())
config.resolve.alias['fast-deep-equal'] = path.resolve(
__dirname,
'node_modules',
'fast-deep-equal'
)
handleScrollToTop() {
import('react-scroll').then(scroll => {
scroll.animateScroll.scrollToTop({
})
})
}
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin')
module.exports = {
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
config.plugins.push(new DuplicatePackageCheckerPlugin())
return config
},
}