Search code examples
vue.jsvuex

Vuex does not provide an export named 'createStore'


I try using vuex with Vue3 and Vite. After installing it with yarn like yarn add vuex@next --save

I get the error:

The requested module '/vite-dev/@fs/home/app/node_modules/.vite/vuex.js?v=f336efac' does not provide an export named 'createStore'

Any idea how to solve this?

EDIT:

store.js

import { createStore } from 'vuex'
...

  const store = createStore({
    plugins: [createPersistedState()],
    state() {
      return {...},

main.js - just importing store file

import { store } from "./store.js";


Solution

  • I got it solved by deleting node_modules and re-installing the dependencies. Not sure why that solved it tho.