Vue 2 → Vue 3
Days Med riskVue 2 reached end-of-life on 2023-12-31. Most apps have already migrated; this guide covers the holdouts and the Mushi-specific pieces.
The Mushi Vue adapter (@mushi-mushi/vue) supports Vue 3 only. Apps
still on Vue 2 must use the vanilla @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 must be converted to regular components or use
defineComponentwithfunctional: trueremoved. v-modelon a custom component changed semantics — see the Vue 3 migration guide .- Vue Router 3 → 4. Vuex 3 → 4 (or Pinia, recommended).
- Mushi:
@mushi-mushi/webdirect usage →@mushi-mushi/vueadapter.
API mapping (Mushi-specific)
| Vue 2 (with @mushi-mushi/web) | Vue 3 (with @mushi-mushi/vue + @mushi-mushi/web) |
|---|---|
Mushi.init({ projectId, apiKey }) in main.js | Same Mushi.init(...) PLUS app.use(MushiPlugin, { projectId, apiKey }) |
Manually attach Vue.config.errorHandler = ... to forward to Mushi | The adapter wires Vue 3’s app.config.errorHandler automatically |
Reach into Mushi directly from any component | Use useMushi() composable inside <script setup> |
Migration checklist
Migration checklist
10 required steps
- Step 01Run vue-compat (the bridge build)
- Step 02Fix every Vue 2-style deprecation warning
- Step 03Remove @vue/compat alias once warnings are zero
- Step 04Upgrade Vue Router 3 → 4
- Step 05Decide: Vuex 4 or Pinia
- Step 06Install the Mushi Vue adapter
- Step 07Replace direct Mushi.init usage with the adapter
- Step 08Migrate components to useMushi()
- Step 09Remove any Vue-2-era Mushi error-handler shims
- Step 10Smoke-test: throw an error, verify it lands as a Mushi report
Common gotchas
- Forgetting
Mushi.init()afterapp.use(MushiPlugin, ...). The Vue plugin only wires the composable + error handler; it does NOT mount the visual widget. You need both calls. (This is also why the in-console Install SDK card emits both lines — it caught a previous regression where users thought one was enough.) <script setup>and Options API mixing. Both work in Vue 3, butuseMushi()only works insidesetup()/<script setup>because it’s a composable. For Options API components, useinject('mushi')(the plugin provides it).- Stale Vue 2 plugins. Some older Mushi-adjacent plugins (Sentry-Vue v6, Vue-Logger v1) only support Vue 2. Audit your plugin list.
Mushi behaviour during the migration
You can run just @mushi-mushi/web 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 to the adapter only after
your app is on real Vue 3 (compat alias removed).
References
Last updated on