I’m using Vike + Vue 3 and I want to add a proper client-side error tracking system (similar to what Next.js provides or what Nuxt does with its error boundary).
My goal is:
Track unhandled errors
Clearly see where errors happen in production
Have a consistent error-handling entry point on the client
I tried using
pages/+client.tsbecause Vike documentation says this file is executed in the browser:// pages/+client.ts console.log("client loaded"); window.addEventListener("error", (err) => { console.log("Error caught:", err); });However:
+client.tsdoes not executeconsole.lognever appearsError handlers are never triggered
Even putting
+client.tsnext to a route (e.g.pages/products/@id/+client.ts) doesn’t load it
Directory structure example:
pages/ index/+Page.vue products/ @id/ +Page.vue +client.tsQuestion:
👉 What is the correct way to implement global client-side error tracking in a Vike + Vue 3 project?
More specifically:
How do I ensure
+client.tsis executed for all routes?How do I properly attach global error listeners (
window.error,unhandledrejection)?Is there a Vike-specific error boundary or global client entry equivalent?
I’m simply trying to reproduce what Next/Nuxt provide:
a reliable place to detect client errors .
Any guidance or sample setup would be appreciated.