Search code examples
node.jsvue.jsvuexserver-side-rendering

Integrate vuex into express-vue


Im using express-vue (https://github.com/express-vue/express-vue)

(A package that should do the ssr for me).

Now I wanted to integrate vuex into my project and I'm little confused on how to do that. I can use the cdn link, but I dont know where I should put this code:

const store = new Vuex.Store({
    state: {
       count: 0
    },
 mutations: {
    increment (state) {
        state.count++
    }
  }
})

(from here: https://vuex.vuejs.org/en/getting-started.html) So that vuex is availible in every component(and mixins if possible) of mine.

(If you have a good suggestion on the usage of npm packages in express-vue I would be happy too, but as far as I know node-modules is not availible for express-vue)


Solution

  • It's not possible yet. As their core team said:

    Support for vuex and other plugins is coming in express-vue@5

    It’s been prematurely published so please don’t use it just yet. But yes soon.