Production-Grade Vue.js

Migrating from Vue 2 to Vue 3

Ben Hong

Ben Hong

Production-Grade Vue.js

Check out a free preview of the full Production-Grade Vue.js course

The "Migrating from Vue 2 to Vue 3" Lesson is part of the full, Production-Grade Vue.js course featured in this preview video. Here's what you'd learn in this lesson:

Ben shares some final thoughts about migrating from Vue 2 to Vue 3. Legacy applications should remain in Vue 2 especially if IE11 support is required. Vue 3 is an appropriate choice for new applications.


Transcript from the "Migrating from Vue 2 to Vue 3" Lesson

>> And so one question that has probably come up and is asked a lot right now is regarding the migration of Vue 2 to Vue 3. And so as it stands right now, Vue 3 as a whole, the too long, didn't read, the TLDR is that if you have a legacy Vue 2 app, you probably should be waiting to migrate to Vue 3, and for the following reasons.

One, Vue 3 at this point doesn't support IE 11. So if that is any part of your user base, and you need the support, and you haven't basically deprecated it on your side, then yes, 100% Vue 3 is a no-go for you. That's not to say it's not coming, in fact, they're currently working on the polyfill, basically the legacy bundle that will then backfill the support to that.

But that is not happening until, I believe, later this year. And then, of course, sometimes deadlines can push back, so it might even be early next year for all we know. And if it does take like that, that is definitely gonna be a showstopper for people who need to migrate.

The other thing as well is that if you have a lot of dependencies, the general advice is please wait until those are officially migrated. Two key examples of this are if you have a component library that you're relying on, like beautify, for example. Then checking out their roadmap to see when exactly their release date is to support Vue 3 features.

And to integrate properly into the Vue 3 architecture is gonna basically be your milestone for waiting until it's ready to upgrade. And similarly, a lot of people using Vue 2 are also using Knucks for many, many great reasons that I sort of referred to earlier, Knucks is awesome.

But if you're using nuxt, this does mean that you want to wait till Knucks 3, which I have confirmation is actively in development. So I'm really excited to see when Knucks 3 comes out. But wait for Knucks 3, right, and so that's the other thing I forgot to mention before I move on to this piece.

The other thing too with migration is that for those who weren't here for the Vue 1 to Vue 2 major upgrade. There actually is going to be a migration tool to help analyze your code bundle and provide basically recommendations for the best path to upgrade. And on top of that, right, similar to the Vue ethos, if anything, we know that we can go ahead and swap out for you.

Cuz we know that it's just a programmatic thing from if this API changed to something that can just be swapped out, the migration tool will help you do that automatically. And so for a lot of people, especially if you have a large code base, this will save you a ton of time.

And so in this regard, go ahead and wait, wait for the migration tool to come out, the IE combat build, go ahead and update. Then it will be worth the effort to go ahead and upgrade your app at that point. The other thing I wanna bring up too is that I know a lot of people here, when we talk about major version upgrades.

Typically, it comes with some thing that you really wanna use and you can't use until you have that major upgrade. And the idea with Vue 2 to Vue 3 was to really keep a lot of the core features and ideas that Vue 2 has. And then basically make it smaller, make it faster, to make it more performant, and then make it more compatible with typescript and those things.

But we talked about types of earlier regarding don't worry about migrating those things. But more importantly, the number one feature that everyone really wants with Vue 3 is the composition API. And so as I mentioned earlier, you don't have to wait till Vue 3 to use that. You can integrate that directly into your Vue 2 app, and start playing with it, and leveraging it for your applications.

And so hopefully, this helps to mitigate a little of the FOMO effect, also known as fear of missing out, like we need to hurry up and be on Vue 3. Don't worry about it, I assure you, your app will come to a point where the ecosystem is ready and you can migrate safely.

And then the team will be really happy, so. [LAUGH]

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now