WEB DEVELOPMENT | VUE.JS

Migrating from Vue 2 to Vue 3

Tolbxela
5 min readDec 26, 2021

My experience and tips of upgrading Vue.js projects to Vue 3

Vue.Js

This year I have migrated my projects to Vue 3 and now I am glad to share with you my experience of upgrading Vue 2 code.

This article will cover a couple of points you have to pay attention to while migrating projects to Vue 3.

Vue 3 has a list of breaking changes you have to deal with. I will cover here only some of them. Please check the official Vue.js Migration Guide for further details.

Vue.js: Migration from Vue 2 Guide

1. New app instance concept with createApp

Vue 3 has changed the way you create the app instance (A New Global API: createApp)

In Vue 2 we have used new Vue({}) to create a new instance of Vue

In Vue 3 you must use the createApp method to create a new app instance

I still don’t have any JavaScript Bundler in my projects and use a CDN build of Vue. In this case, the method createApp is exposed via the global Vue object:

Or we can just directly use the Vue.createApp()method like this

const app = Vue.createApp({})

You can use the same way of…

--

--