In my Nuxt project, I have set up a default store in Nuxt within the store/index.js
file as per the guidelines provided in the documentation. However, upon trying to render my app, I encounter the following error:
Uncaught Error: [nuxt] store/index.js should export a method that returns a Vuex instance.
The content of my store/index.js
file is as follows:
import Vuex from 'vuex'
import Vue from 'vue'
import myModule from './myModule'
Vue.use(Vuex)
const store = new Vuex.Store({
state: () => ({
}),
mutations: {},
actions: {},
modules: {
myModule: myModule
}
})
export default store
How can I resolve this issue?