简体   繁体   中英

Is that possible to use Vue 3 compiled/build into Vue 2 project?

I am trying to create new project using Vue 3 typescript, but I want to use this project into my existing Vue 2, why I am using this? Because I need to fully revamp the website,but to revamp this need time, and you know that Product Manager want those things release sooner So I can't do fully revamp done by rewrite, it gonna be per Phase

My ways are make the components on Vue 3 and then build it to define on Vue 3 project

Is that possible? Or is that any way to solve this?

No, you can't use Vue 3 components in a Vue 2 project, but you can do the inverse. Use the Vue 3 migration build to enable Vue 2 components in a Vue 3 project. This build was designed with the purpose of progressively migrating your Vue 2 project to the new version, which sounds like what you're trying to do.

If in a Vue 3 project, when installing a Vue 2 NPM package that has a peer dependency on Vue 2 (such as vue-select ), you'll encounter an installation error like this:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: vue3-with-vue-select@0.1.0
npm ERR! Found: vue@3.2.3
npm ERR! node_modules/vue
npm ERR!   vue@"^3.0.4" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"2.x" from vue-select@3.12.2
npm ERR! node_modules/vue-select
npm ERR!   vue-select@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

To resolve the error, use the --force flag:

npm install --force --save vue-select

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM