module.exports = extends: ['plugin:vue/vue3-recommended'], // yes, 'vue3' works for 2.7 ; Most apps work without changes. But be aware of these: 1. v-model on custom components Vue 2.7 aligns with Vue 3’s v-model behavior. Previously, v-model on a component compiled to value + input . Now it compiles to modelValue + update:modelValue .
"dependencies": "vue": "^2.7.14"
Start with a clean backup, follow the steps above, and you'll have a future-ready Vue 2 codebase. Last updated: March 2025 – compatible with Vue 2.7.16
npm install -g vetur@latest # or update via VS Code extensions If using ESLint plugin for Vue: upgrade vue 2.6 to 2.7
Update tsconfig.json :
</script> <script setup> import ref from 'vue' const count = ref(0) </script> <template> <button @click="count++"> count </button> </template> Optional chaining and nullish coalescing <template> <div> user?.address?.city ?? 'Unknown' </div> </template> Reactivity Transform (opt-in) Enable via vue-loader config:
- this.$scopedSlots.header(data) + this.$slots.header(data) Functional components using the functional: true option or <template functional> still work, but the performance benefit is minimal. Consider migrating to normal components. 4. props validation Default factory functions no longer have access to this . Use arrow functions or external helpers. New Features to Start Using Composition API (no extra import) <script> import ref, onMounted from 'vue' export default setup() const count = ref(0) onMounted(() => console.log('mounted')) return count module
npm install vue-loader@^15.10.0 --save-dev For Webpack config, ensure .vue files are handled correctly:
// webpack.config.js module.exports = module: rules: [ test: /\.vue$/, loader: 'vue-loader', , ], , plugins: [ new (require('vue-loader')).VueLoaderPlugin(), ], ; If using vue-cli (v4 or v5), no action is needed – it handles the update automatically. Vue 2.7 ships with its own TypeScript declarations. Remove any custom shims-vue.d.ts that redeclare .vue modules.
If you used @vue/runtime-dom or @vue/runtime-core types, remove them. Update vetur to latest: Previously, v-model on a component compiled to value + input
npm uninstall vue-template-compiler npm uninstall @vue/composition-api Then update imports:
"compilerOptions": "types": ["vue"]
- import ref, computed from '@vue/composition-api' + import ref, computed from 'vue' If using vue-loader v15: