1. Measure what breaks
Run vueleap at the root of the project. It reads .vue, JavaScript, TypeScript and style files plus package.json, skips node_modules, dist and anything in .gitignore, and groups findings by rule.
# run it once, nothing to install
npx vueleap
# or add it to the project
npm install --save-dev vueleap# run it once, nothing to install
pnpm dlx vueleap
# or add it to the project
pnpm add --save-dev vueleap# run it once, nothing to install
yarn dlx vueleap
# or add it to the project
yarn add --dev vueleap# run it once, nothing to install
bunx vueleap
# or add it to the project
bun add --dev vueleapAdd --html report.html to also get a shareable report, like this sample report.
Every finding has a severity: error breaks at compile time or runtime, warning changes behavior, info deserves a review. The summary ends with an effort score to compare projects or track progress.
2. Upgrade the build tooling
Vue 3 single file components are compiled by @vue/compiler-sfc, which ships with vue. Remove vue-template-compiler, use vue-loader 17 with webpack or Vue CLI 5, or @vitejs/plugin-vue with Vite. vueleap reports these under vue2-tooling.
3. Install Vue 3 with the migration build
npm install vue@^3.5 @vue/compat@^3.5
npm uninstall vue-template-compilerAlias vue to @vue/compat and enable compat mode in the template compiler. vueleap prints this configuration with only the flags your project needs, running everything else in Vue 3 mode (MODE: 3):
// vite.config.js
import vue from '@vitejs/plugin-vue'
export default {
resolve: { alias: { vue: '@vue/compat' } },
plugins: [
vue({
template: {
compilerOptions: {
compatConfig: { MODE: 3, COMPILER_FILTERS: true, COMPILER_V_BIND_SYNC: true },
},
},
}),
],
}// main.js
import { configureCompat } from 'vue'
configureCompat({
MODE: 3,
GLOBAL_MOUNT: true,
INSTANCE_EVENT_EMITTER: true,
FILTERS: true,
})Read Compat flags for what each flag does.
4. Apply the safe automatic fixes
Some changes are pure renames. vueleap rewrites them while preserving formatting, and shows a diff first:
npx vueleap --fix # preview
npx vueleap --fix --write # applyThat covers beforeDestroy and destroyed, custom directive hooks, $scopedSlots, transition class names, keyCode modifiers with a single key name, .sync to v-model:prop, @hook: events and Vue.config.productionTip.
5. Fix the rest, rule by rule
- Replace
new Vue()withcreateApp()and moveVue.use,Vue.component,Vue.directiveandVue.prototypeto the app instance. - Turn filters into method calls, for example
{{ price | currency }}into{{ currency(price) }}, and replace an event bus built on$onand$offwith a small emitter, props and emits, or a store. - Update components used with v-model to
modelValueandupdate:modelValue. - Rewrite render functions to import
hfromvue, and replace$listenersand$children.
import Vue from 'vue'
Vue.use(router)
new Vue({
store,
render: (h) => h(App),
}).$mount('#app')import { createApp } from 'vue'
createApp(App)
.use(router)
.use(store)
.mount('#app')The rules reference links every rule to the official guide.
6. Upgrade the ecosystem
Move to vue-router 4 and to Vuex 4 or Pinia. Replace Vue 2 only UI libraries with their Vue 3 successors, for example Vuetify 2 with Vuetify 3 and Element UI with Element Plus. vueleap lists them from package.json with the suggested successor.
7. Turn compat off and keep it off
Remove each compat flag once vueleap no longer reports the matching rule. When the list is empty, drop the alias and @vue/compat. Then keep the codebase clean in CI:
npx vueleap --fail-on errorTrack the whole plan with the migration checklist on the home page. It remembers what you ticked.
Notes
- You can go one step at a time. On the migration build each compat flag can be turned off once the matching code is fixed, so the app keeps running the whole way.
- The Options API stays. It is fully supported in Vue 3. Migrate first, then adopt the Composition API where it helps.
- Libraries usually take the longest. The effort score at the end of the report weighs each finding, with fixable ones counting for a tenth.