This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"files": [ | |
{ | |
"path": ".next/static/**/main-*.js", | |
"maxSize": "30 kB", | |
"compression": "brotli" | |
}, | |
{ | |
"path": ".next/static/chunks/pages/my-page-*.js", | |
"maxSize": "8 kB", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Budget to check the mininum in each step | |
const PERFORMANCE = 0.8; | |
const ACCESSIBILITY = 0.8; | |
const BEST_PRACTICES = 0.8; | |
const SEO = 0.8; | |
// Extra headers | |
const headers = {}; | |
// URLs to check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
webpack: (config, options) => { | |
const { isServer, webpack } = options; | |
if (isServer) { | |
// Use the react from node_modules | |
} else { | |
config.externals = { | |
react: 'React', | |
'react-dom': 'ReactDOM', | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var resources = [ | |
'https://unpkg.com/react@18/umd/react.production.min.js', | |
'https://unpkg.com/react-dom@18/umd/react-dom.production.min.js', | |
]; | |
/** Apply prefetch for subsequences */ | |
function prefetchResources(resources) { | |
for (var i = 0; i < resources.length; i++) { | |
var xhrRequest = new XMLHttpRequest(); | |
xhrRequest.open('GET', resources[i], true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState } from "react"; | |
/** | |
* Hook to check the current visibility of the page | |
* Documentation: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API | |
* @returns boolean | |
*/ | |
const useVisibilityChange = () => { | |
const [isVisible, setIsVisible] = useState(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function matrix(rows, cols, initial = 0) { | |
const arr = []; | |
for (let i = 0; i < rows; i++) { | |
arr[i] = Array.from(new Array(cols)).fill(initial); | |
} | |
return arr; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const app = express(); | |
const PORT = process.env.PORT || 3001; | |
// Replace with your logger | |
const logger = console; | |
// Endpoint for health check API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require("axios"); | |
const Agent = require("agentkeepalive"); | |
const CircuitBreaker = require("opossum"); | |
// Replace with your configs | |
const TIMEOUT_DEFAULT = 2500; | |
const MAX_SOCKETS = 100; | |
const MAX_FREE_SOCKET = 10; | |
const TIME_OUT_KEEP_ALIVE = 60000; | |
const FREE_SOCKET_TIMEOUT = 30000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const app = express(); | |
const PORT = process.env.PORT || 3001; | |
// Replace with your logger | |
const logger = console; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const cluster = require("cluster"); | |
const os = require("os"); | |
const PORT = process.env.PORT || 3001; | |
// Replace with your logger | |
const logger = console; | |
// If the current is master, create the fork for all the cpus |
OlderNewer