Home > Net >  Why "Vue is not defined" when using Vue 3 Vuex 4?
Why "Vue is not defined" when using Vue 3 Vuex 4?

Time:03-11

I'm trying to migrate form props to Vuex 4. But when I import Vuex I get Vue is not defined.

CodePudding user response:

Please add this script to your Html section

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.18/vue.min.js"></script>

And it will work.

CodePudding user response:

add to your index.html

<script src="https://unpkg.com/vue@3"></script>

Or just use npm init vue@latest while you trying to create your application.

CodePudding user response:

In your entry point, that you import Vuex. Add this:

import Vue from "vue"
import Vuex from "vuex"
Vue.use(Vuex)

Remember install dependences

  • Related