feat: support vercel speed insight (#3686)

This commit is contained in:
Fred Liang
2023-12-28 23:10:19 +08:00
committed by GitHub
parent f8b963df6d
commit 406530ca69
4 changed files with 23 additions and 2 deletions

View File

@@ -4,6 +4,10 @@ import "./styles/markdown.scss";
import "./styles/highlight.scss";
import { getClientConfig } from "./config/client";
import { type Metadata } from "next";
import { SpeedInsights } from "@vercel/speed-insights/next";
import { getServerSideConfig } from "./config/server";
const serverConfig = getServerSideConfig();
export const metadata: Metadata = {
title: "NextChat",
@@ -35,7 +39,14 @@ export default function RootLayout({
<link rel="manifest" href="/site.webmanifest"></link>
<script src="/serviceWorkerRegister.js" defer></script>
</head>
<body>{children}</body>
<body>
{children}
{serverConfig?.isVercel && (
<>
<SpeedInsights />
</>
)}
</body>
</html>
);
}