Skip to content

Commit eb37fd6

Browse files
committed
fix: use non-deprecated werb-vitals functions
1 parent 79d962b commit eb37fd6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/runtime/web-vitals.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ export async function webVitals({ route, options, sendToAnalytics }) {
1313

1414
try {
1515
// eslint-disable-next-line @typescript-eslint/no-explicit-any
16-
const { getCLS, getFID, getLCP, getTTFB, getFCP } = await import('web-vitals').then((r: any) => r.default || r)
17-
getFID(metric => sendToAnalytics(context, metric, options))
18-
getTTFB(metric => sendToAnalytics(context, metric, options))
19-
getLCP(metric => sendToAnalytics(context, metric, options))
20-
getCLS(metric => sendToAnalytics(context, metric, options))
21-
getFCP(metric => sendToAnalytics(context, metric, options))
16+
const { onCLS, onFID, onLCP, onTTFB, onFCP } = await import('web-vitals').then((r: any) => r.default || r) as typeof import('web-vitals')
17+
onFID(metric => sendToAnalytics(context, metric, options))
18+
onTTFB(metric => sendToAnalytics(context, metric, options))
19+
onLCP(metric => sendToAnalytics(context, metric, options))
20+
onCLS(metric => sendToAnalytics(context, metric, options))
21+
onFCP(metric => sendToAnalytics(context, metric, options))
2222
}
2323
catch (err) {
2424
logError(err)

0 commit comments

Comments
 (0)