Wasiq Bin Zahid
Wasiq Bin Zahid

Reputation: 134

Updating Vue 2 to Vue 3

I have an old Vue 2 project that we are migrating to Vue 3, it had bootstrap which I ended up removing considering its old versions don't work really well with vue 3. Everything else seems fine except this error,

This dependency was not found:

* vue in ./src/main.js, ./src/api/store.js and 3 others

To install it, you can run: npm install --save vue

I used vue update to update to vue 3, npm update to upgrade some dependencies, and had to use --legacy-peer-deps with the npm commads the first time, I had some errors which were removed after removing bootstrap imports from main.js. I have looked around, can't seem to find the solution for this, haven't worked with Vue3 a lot, any help would be appreciated thanks.
This is my main.js enter image description here

This is me initializing app --- used to work before vue update

enter image description here

This is package.json vue enter image description here

/Edit/

I changed import Vue to vue createApp, had some errors in terminal and terminal told me to update vue-loader to latest version, which I did and now I'm getting this error. I have removed almost all of Vue.use items to make sure atleast app.vue loads and then I can move on from there. I'm following this tutorial

https://blog.logrocket.com/refactoring-vue-2-apps-vue-3/

New errors

I'm getthing this issue even though VueLoaderPlugin is in webpack config file

const VueLoaderPlugin = require('vue-loader/lib/plugin')

enter image description here

Upvotes: 1

Views: 2069

Answers (1)

Brother Woodrow
Brother Woodrow

Reputation: 6382

It simply doesn't work like that anymore in Vue 3. import Vue and new Vue() have been replaced by:

import { createApp } from 'vue';

const app = createApp(App);

Vue 3 isn't a drop-in replacement for Vue 2; there's a number of breaking changes you should probably read up on.

Upvotes: 1

Related Questions