Search code examples
vue.jsvuex

Uncaught TypeError: router.afterEach is not a function


Trying to use this demo application: https://github.com/skyronic/vue-spa

to start a Vuex project but I'm gettig this error Uncaught TypeError: router.afterEach is not a function

relating to vuex-router-sync.

Can anyone help because I cannot find anything online.

My main.js entry point is:

import App from './pages/App'
import router from './router'
import store from './vuex/store'
import { sync } from 'vuex-router-sync'

sync(store, router)

router.start(App, '#app')

I am not actually calling the router.afterEach fucntion from within my example but it is used by the vuex-router-sync package. Sorry I'm not knowledgeable enough to pin point this in more detail.

The function is called by the package on line 25 https://github.com/vuejs/vuex-router-sync/blob/master/index.js

Thanks for everyone's help so far :)


Solution

  • This issue has been resolved by the vendor. https://github.com/skyronic/vue-spa/issues/2

    Updates were made to the code base.