Add Vercel Analytics via client plugin; use Yarn lockfile and remove npm lockfile
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource-variable/roboto-slab": "^5.2.6",
|
"@fontsource-variable/roboto-slab": "^5.2.6",
|
||||||
|
"@vercel/analytics": "^1.5.0",
|
||||||
"bulma": "^1.0.4",
|
"bulma": "^1.0.4",
|
||||||
"nuxt": "^4.0.3",
|
"nuxt": "^4.0.3",
|
||||||
"typescript": "^5.6.3",
|
"typescript": "^5.6.3",
|
||||||
|
17
plugins/vercel-analytics.client.ts
Normal file
17
plugins/vercel-analytics.client.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
export default defineNuxtPlugin(() => {
|
||||||
|
if (import.meta.env.PROD) {
|
||||||
|
import('@vercel/analytics')
|
||||||
|
.then(({ inject }) => {
|
||||||
|
try {
|
||||||
|
inject();
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
// ignore
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user