title: How do I commit a vuex store mutation from inside a vue-router route that imports "store"?
body: <p>My goal is to commit (invoke/call) a mutation that I've defined in my Vuex store.</p>
  <p><strong>store/store.js</strong></p>
  <pre><code>export default {
    modules: {
      app: {
        state: {
          shouldDoThing: false,
        }
        mutations: {
          setShouldDoThing: (state, doThing) =&gt; { state.shouldDoThing = doThing },
        }
      }
    }
  }
  </code></pre>
  <p>Since I attach Vuex to my app, I can use <code>this.$store.commit</code> throughout the app in various components without issue.</p>
  <p><strong>main.js</strong></p>
  <pre><code>import Store from 'store/store.js';
  import Vue from 'vue';
  import Vuex from 'vuex';
  
  Vue.use(Vuex);
  const app = new Vue({
    el: '#app-root',
    store,
    // ...etc
  });
  </code></pre>
  <p>For example:</p>
  <p><strong>exampleComponent.vue</strong></p>
  <pre><code>export default {
    created() {
      // This works!
      this.$store.commit('setShouldDoThing', true);
    },
  }
  </code></pre>
  <p>Now I'd like to commit something from a vue-router Route file, in a <code>beforeEnter</code> method:</p>
  <p><strong>exampleRoute.js</strong></p>
  <pre><code>import Store from 'store/store.js'
  
  const someRoute = {
    path: '/blah',
    beforeEnter(to, from, next) {
      Store.commit('setShouldDoThing', true);
      next();
    }
  }
  </code></pre>
  <p>However, when I try the above, I get the error</p>
  <pre><code>TypeError: _state_store__WEBPACK_IMPORTED_MODULE_10__.default.commit is not a function
  </code></pre>
  <p>There's lots of examples online of successfully using vuex getters by importing. And, if I <code>console.log()</code> the <code>Store</code> import, I can see my entire store structure</p>
  <pre><code>modules:
    app:
      actions: {someAction: ƒ, …}
      getters: {isStartingQuery: ƒ}
      mutations: {ariaAnnounce: ƒ, …}
      state: {…}
      __proto__: Object
  </code></pre>
  <p><strong>How can I import my Store and then <code>commit</code> a mutation from within a vue-router file?</strong></p>