Add Vercel Analytics via client plugin; use Yarn lockfile and remove npm lockfile
This commit is contained in:
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