Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

martinszeltins's avatar

Unknown action type when using Vuex 4.0-beta with modules

I'm living on the bleeding edge here, I know. But I’m getting this error when using Vuex 4 with modules to dispatch a namespaced action. I’m also using Vite.

It's strange because I came across somewhere that in Vuex 4 you have a new syntax like store.module.dispatch.action() but I'm not sure.

setup() {
    const store = useStore();
    store.dispatch('app/doSomething')
}

vuex.esm-bundler.js:465 [vuex] unknown action type: app/doSomething

This also fails..

setup() {
    const store = useStore();
    store.app.dispatch.doSomething();
}

vuex.esm-bundler.js:465 [vuex] unknown action type: doSomething

Here is my app module

import { createStore } from 'vuex'
 
export default createStore({

namespaced: true,

  state()
  {
    return {
      count: 911
    }
  },

  actions:
  {
      doSomething()
      {
          alert('action doing something..')
      },
  },
})
0 likes
1 reply
Felipe Riv's avatar

Hi did you fix it ? I have the same problem and I've been trying to fix it but I have no idea how.. =/

Please or to participate in this conversation.