Skip to content

Commit d6311fa

Browse files
committed
refactor: move vercel script to dynamic
1 parent 9a0193e commit d6311fa

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

pages/_app.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
import { Analytics } from '@vercel/analytics/react';
2-
import { SpeedInsights } from '@vercel/speed-insights/next';
31
import { ThemeProvider } from 'next-themes';
42
import type { AppProps } from 'next/app';
3+
import dynamic from 'next/dynamic';
54
import { SWRConfig } from 'swr';
65

76
import { Layout } from '@/components/layout';
87

98
import '../styles/globals.css';
109

10+
const Analytics = dynamic(
11+
() => import('@vercel/analytics/react').then((m) => m.Analytics),
12+
{ ssr: false },
13+
);
14+
15+
const SpeedInsights = dynamic(
16+
() => import('@vercel/speed-insights/next').then((m) => m.SpeedInsights),
17+
{ ssr: false },
18+
);
19+
1120
function MyApp({ Component, pageProps }: AppProps) {
1221
return (
1322
<>

0 commit comments

Comments
 (0)