underfin / vite-plugin-vue2

Vue2 plugin for Vite
620 stars 83 forks source link

How to handle vuex-class error #178

Open choisohyun opened 2 years ago

choisohyun commented 2 years ago

I am currently using vuex and vuex-class together.
However, there is an error saying that the module cannot be found in the place using namespace, which is the vuex-class syntax.
How to avoid errors while using vuex-class?

    "vuex": "^3.6.2",
    "vuex-class": "^0.3.2",
Screen Shot 2022-03-13 at 11 42 19

Below are some codes of the namespace usage part.

const bottomNavStore = {
  namespaced: true,
  state: {
    bottomNavigation: null,
  },
  mutations: {
    SET_BOTTOM_NAV: function(state: BottomNavState, bottomNav: BottomNavObject) {
      state.bottomNavigation = bottomNav;
    },
    UNSET_BOTTOM_NAV: function(state: BottomNavState) {
      state.bottomNavigation = null;
    },
  },
  actions: {},
  getters: {
    getBottomNav: function(state: BottomNavState) {
      return state.bottomNavigation;
    },
  },
};

export default bottomNavStore;

...

import * as requireModules from './modules';
export default new Vuex.Store({
  strict: import.meta.env.VITE_NODE_ENV !== 'production',
  modules: requireModules,
  ...root,
});

...

const bottomNav = namespace('bottomNav');

  @bottomNav.Getter('getBottomNav')
  private readonly hasBottomNav;

please check.