我正在尝试将 vuejs 3 集成到使用 webpack 的现有项目中。我读过 vue-loader,所以我正在尝试使用它。
在官方文档中,我有这个:
每次发布新版本的 vue 时,都会同时发布相应版本的 vue-template-compiler。编译器的版本必须与基础 vue 包同步,以便 vue-loader 生成与运行时兼容的代码。这意味着每次升级项目中的 vue 时,都应该升级 vue-template-compiler 以匹配它。
因此,当我尝试编译时,出现此错误:
Vue packages version mismatch:
- vue@3.0.2 (/home/alejo/playground/parquesFrontend/node_modules/vue/index.js)
- vue-template-compiler@2.6.12 (/home/alejo/playground/parquesFrontend/node_modules/vue-template-compiler/package.json)
This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using vue-loader@>=10.0, simply update vue-template-compiler.
If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.
Run Code Online (Sandbox Code Playgroud)
但是当我尝试安装 vue-template-compiler@3.0.2 时,我收到此错误:
? npm install vue-template-compiler@3.0.2
npm ERR! code …Run Code Online (Sandbox Code Playgroud)