By Xavier Collantes
1/26/2024
1const withBundleAnalyzer = require("@next/bundle-analyzer")({
2 enabled: process.env.ANALYZE === "true",
3})
4
5/** Listing of domains allows for calls to external source. */
6module.exports = withBundleAnalyzer({
7 transpilePackages: ["@stripe/firestore-stripe-payments"],
8
1npm install -g depcheck
2npm install -g depcheck typescript
3npx depcheck
4
const BigComponent = dynamic(() => import("../bigcomponent"))
when you
do not need a dependency right away to avoid loading all dependencies.1const ContentForm = dynamic(
2 () => import("./components/Content").then((component) => component.Function),
3 {
4 loading: () => <Loading />,
5 ssr: false,
6 }
7)
8
const Component = (await import("comp.js")).default
Use dynamic importing carefully since there are cases where you do not want the content to be delayed on loading. For example, a metric used by Google is LCP which will count the time the largest image becomes renders to the user.
Related by topics: