How to implement client-side error tracking in Vike (Vue 3) similar to Next.js / Nuxt?
05:17 25 Nov 2025

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:

  1. Track unhandled errors

  2. Clearly see where errors happen in production

  3. Have a consistent error-handling entry point on the client

    I tried using pages/+client.ts because 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.ts does not execute

    • console.log never appears

    • Error handlers are never triggered

    • Even putting +client.ts next 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.ts
    
    

    Question:

    👉 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.ts is 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.

javascript vue.js error-handling custom-error-handling