ryer.io

Vue 2 to Vue 3 Migration Notes

TL;DR

  • Reviewing three lessons covering migration from Vue 2 to Vue 3, using vue-compat for specific patterns.
  • In Vue 2, a GL toast component was injected into the global prototype using view.use, polluting things globally.
  • Vue 3 injects components at the app instance level via a new view.app and app.use.
  • A GL toast mixin is more flexible.
  • Working with Claude to understand migration mechanics, including pre- and post-migration steps.

Migration Lessons Overview

These three lessons cover migrating from view two to view three, using view compat to handle specific patterns.

GL Toast Component: Global vs. App-Level Injection

In view two, a GL toast component was injected into the global prototype using view.use, which polluted many things at the global level. View three instead injects such components at the app instance level: you create a new view.app and use app.use to add it there. A GL toast mixin turns out to be more flexible.

Working Through Migration Mechanics

I’m working with Claude to understand the mechanics of migration, including pre- and post-migration steps. If we keep module-level expressions,