Skip to Content
v1.36.0 · shipped One-screen report · Looks like your app Read the changelog →
Migration guidesVue 2 → Vue 3

Vue 2 → Vue 3

Days Med risk

Vue 2 reached end-of-life on 2023-12-31. This guide covers the upgrade and the Mushi Mushi pieces.

The Mushi Mushi Vue adapter (mushi-mushi/vue) supports Vue 3.3 and later (its peer dependency is vue >=3.3). Apps still on Vue 2 use the plain mushi-mushi web SDK; this guide brings you onto the adapter.

Vue 2 is no longer receiving security patches. The Vue team’s official recommendation is to migrate. If you cannot, HeroDevs ships a paid LTS  for Vue 2.7 with security backports.

What changes (high level)

  • new Vue({...}).$mount(...) → createApp(App).mount(...)
  • Options API still works in Vue 3, but the Composition API is the recommended style. You can mix both during the migration.
  • Filters are gone. Methods or computed properties replace them.
  • Functional components are plain functions in Vue 3; the functional option and <template functional> are gone.
  • v-model on a custom component changed semantics; see the Vue 3 migration guide .
  • Vue Router 3 → 4. Vuex 3 → 4 (or Pinia, recommended).
  • Mushi Mushi: mushi-mushi direct usage → mushi-mushi/vue adapter.

API mapping (Mushi Mushi)

Vue 2 (with mushi-mushi)Vue 3 (with mushi-mushi/vue)
Mushi.init({ projectId, apiKey }) in main.jsapp.use(MushiPlugin, { projectId, apiKey }) only; the plugin calls Mushi.init() itself
Manually attach Vue.config.errorHandler = ... to forward to Mushi MushiThe adapter chains onto Vue 3’s app.config.errorHandler automatically
Use the instance from Mushi.init() in componentsUse the useMushi() composable inside <script setup> / setup()

Migration checklist

Migration checklist
10 required steps
  1. Step 01
    Run vue-compat (the bridge build)
  2. Step 02
    Fix every Vue 2-style deprecation warning
  3. Step 03
    Remove @vue/compat alias once warnings are zero
  4. Step 04
    Upgrade Vue Router 3 → 4
  5. Step 05
    Decide: Vuex 4 or Pinia
  6. Step 06
    Install the Mushi Mushi Vue adapter
  7. Step 07
    Replace direct Mushi.init usage with the adapter
  8. Step 08
    Migrate components to useMushi()
  9. Step 09
    Remove any Vue-2-era Mushi Mushi error-handler shims
  10. Step 10
    Smoke-test: throw an error, verify it lands as a Mushi Mushi report

Common gotchas

  • Calling Mushi.init() as well as app.use(MushiPlugin, ...). Since @mushi-mushi/vue 1.0 the plugin initialises the SDK itself; a second Mushi.init() only logs “Already initialized”. Remove it.
  • <script setup> and Options API mixing. Both work in Vue 3, but useMushi() is a composable, so call it inside setup() / <script setup>. In an Options API component, add a setup() option that returns it, or use Mushi.getInstance() from mushi-mushi.
  • Stale Vue 2 plugins. Check each Vue plugin you use (error reporting, logging, UI kits) for a Vue 3 version.

Mushi Mushi during the migration

You can run just mushi-mushi (no /vue import) in compat mode and it works. The adapter is purely additive: it gives you a nicer composable API and auto-wires the error handler. Migrate Mushi Mushi to the adapter only after your app is on real Vue 3 (compat alias removed).

References

Last updated on