对于项目太大,升级有难度,又想体验compositionAPI的可以先过渡到vue2.7
官方升级指南:https://blog.vuejs.org/posts/vue-2-7-naruto.html
~4.5.18
~5.0.6
修改前:
"@vue/cli-plugin-babel": "^3.12.1",
"@vue/cli-plugin-eslint": "^3.12.1",
"@vue/cli-service": "^3.12.1",
修改后:
"@vue/cli-plugin-babel": "~4.5.18",
"@vue/cli-plugin-eslint": "~4.5.18",
"@vue/cli-service": "~4.5.18",
修改前:
"core-js": "^2.6.11",
修改后:
"core-js": "^3.25.1",
修改前:
"sass": "~1.32.6",
"sass-loader": "^7.3.1",
修改后:
"sass": "~1.32.6",
"sass-loader": "^8.0.2",
修改前:
css: {
loaderOptions: {
sass: {
data: `@import "@/variables.scss";@import "@/common.scss";`
}
}
}
修改后:
css: {
loaderOptions: {
sass: {
prependData: `@import "@/variables.scss";@import "@/common.scss";`
}
}
}
修改前:
module.exports = {
presets: [
'@vue/app'
]
}
修改后:
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
删除"vue-template-compiler",因为在2.7中不再需要它
修改前:
"vue": "^2.6.11",
"vue-template-compiler": "^2.6.11"
修改后:
"vue": "^2.7.0"