Reputation: 111
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 ?
Upvotes: 6
Views: 10349
Reputation: 138226
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: [email protected]
npm ERR! Found: [email protected]
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 [email protected]
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
Upvotes: 5