perf(build): measure the homepage and fix optimizePackageImports
/ is the highest-traffic route but was missing from both the public-route instrumentation and the JS size budgets, so a payload regression there could never fail the build. It is now wrapped in withPublicPagePerformance and budgeted alongside the other public routes. optimizePackageImports listed date-fns, which is not a dependency (a no-op), while omitting the barrel-heavy packages that are actually imported: motion, @dnd-kit/core, @dnd-kit/sortable and @tanstack/react-virtual.
This commit is contained in:
1 parent
bb3799f705
commit
a32cf6119b
4 files changed
+19
-2
No files matched your search
+9
-1
@@ -158,7 +158,15 @@ const nextConfig: NextConfig = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
experimental: {
|
experimental: {
|
||||||
optimizePackageImports: ["lucide-react", "date-fns"],
|
// Barrel-heavy packages: without this every import pulls the whole
|
||||||
|
// module graph into the chunk that first touches it.
|
||||||
|
optimizePackageImports: [
|
||||||
|
"lucide-react",
|
||||||
|
"motion",
|
||||||
|
"@dnd-kit/core",
|
||||||
|
"@dnd-kit/sortable",
|
||||||
|
"@tanstack/react-virtual",
|
||||||
|
],
|
||||||
useTypeScriptCli: true,
|
useTypeScriptCli: true,
|
||||||
hideLogsAfterAbort: true,
|
hideLogsAfterAbort: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"mode": "enforce",
|
"mode": "enforce",
|
||||||
"routes": [
|
"routes": [
|
||||||
|
{
|
||||||
|
"route": "/",
|
||||||
|
"maxInitialRawBytes": 716800,
|
||||||
|
"maxInitialGzipBytes": 225280
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"route": "/me",
|
"route": "/me",
|
||||||
"maxInitialRawBytes": 716800,
|
"maxInitialRawBytes": 716800,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import { cached } from "@/lib/cache";
|
|||||||
import { CameraWeb, db, User } from "@/lib/db";
|
import { CameraWeb, db, User } from "@/lib/db";
|
||||||
import { formatDate } from "@/lib/format-date";
|
import { formatDate } from "@/lib/format-date";
|
||||||
import { resolveHotelName } from "@/lib/hotel-name";
|
import { resolveHotelName } from "@/lib/hotel-name";
|
||||||
|
import { withPublicPagePerformance } from "@/lib/public-page-performance";
|
||||||
import { captchaConfig } from "@/lib/services/captcha";
|
import { captchaConfig } from "@/lib/services/captcha";
|
||||||
import { getNewsList } from "@/lib/services/news-list";
|
import { getNewsList } from "@/lib/services/news-list";
|
||||||
import { loadProfilePrivacyMap } from "@/lib/services/profile-privacy";
|
import { loadProfilePrivacyMap } from "@/lib/services/profile-privacy";
|
||||||
@@ -238,7 +239,7 @@ async function getHotelData() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function Home() {
|
async function Home() {
|
||||||
const session = await auth();
|
const session = await auth();
|
||||||
if (session?.user?.id) redirect("/me");
|
if (session?.user?.id) redirect("/me");
|
||||||
|
|
||||||
@@ -1148,3 +1149,5 @@ export default async function Home() {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default withPublicPagePerformance("/", Home);
|
||||||
@@ -4,6 +4,7 @@ import { collectPerformance } from "./performance-diagnostics";
|
|||||||
import { type PerformanceSample, recordPerformance } from "./performance-store";
|
import { type PerformanceSample, recordPerformance } from "./performance-store";
|
||||||
|
|
||||||
type PublicRoute =
|
type PublicRoute =
|
||||||
|
| "/"
|
||||||
| "/me"
|
| "/me"
|
||||||
| "/news"
|
| "/news"
|
||||||
| "/news/[slug]"
|
| "/news/[slug]"
|
||||||
|
|||||||
Reference in new issue
Block a user