chore(docs): dynamically import webvitals

This commit is contained in:
braks
2023-05-17 13:35:44 +02:00
committed by Braks
parent 0e7f3c223c
commit 2bac3d5afc
2 changed files with 10 additions and 7 deletions
@@ -2,14 +2,16 @@
import { watch } from 'vue'
import { useRoute } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import { webVitals } from '../../plugins/vercel-web-vitals-api'
const { Layout: ParentLayout } = DefaultTheme
const route = useRoute()
onMounted(() => {
webVitals({ analyticsId: '__ANALYTICS_ID__', debug: false })
onMounted(async () => {
if (!import.meta.env.DEV) {
const { webVitals } = await import('../../plugins/vercel-web-vitals-api')
webVitals({ analyticsId: '__ANALYTICS_ID__', debug: false })
}
})
watch(