Vite doesn’t support vuex


Sorry for my bad English. I’m creating a Vue application. Now, I want to add vuex to my project.
Vuex was added success, but I’m can’t add a vuex store. And when I include the vuex script:

import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    userData: "USER!"
  },
  mutations: {

  },
  actions: {

  },
  getters: {

  }
})

export default store

I’m getting an error:

Uncaught SyntaxError: The requested module ‘/node_modules/.vite/vue.js?v=52de2cee’ does not provide an export named ‘default’

main.js

import { createApp } from 'vue'
import App from './App.vue'
import router from '@/router'
const app = createApp(App)
import Vuex from 'vuex'
import { store } from '@/store/users'

app.use(router)
app.use(Vuex)

app.mount('#app')

What I’m doing wrong? Thanks a lot.

Source: Vue – Stack Overflow

November 27, 2021
Category : News
Tags: javascript | vite | Vue.js | vuejs3 | vuex

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.