Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: [vuex] getters should be function but "getters.countermod/counter" in module "dummylib" is 1. #1748

Closed
bitquality opened this issue May 13, 2020 · 3 comments

Comments

@bitquality
Copy link

bitquality commented May 13, 2020

Version

3.4.0

Reproduction link

https://new-issue.vuejs.org/?repo=vuejs/vuex

Steps to reproduce

I get the following error while i try to import the plugin component with vuex modules in another vue project.

Uncaught Error: [vuex] getters should be function but "getters.countermod/counter" in module "dummylib" is 1.
Following is my plugin code with vuex modules
    //mystore/mod1/index.ts:

    import { actions } from "./actions"
    import { getters } from "./getters"
    import { mutations } from "./mutations"
    import { state } from "./state"

    export default {
      state,
      mutations,
      getters,
      actions
    }

    //mystore/index.js:

    import Vue from 'vue';
    import Vuex from 'vuex';
    import countermod  from './countermod';


    Vue.use(Vuex);

    export default new Vuex.Store({
      modules: {
        countermod
      },
    });
@bitquality
Copy link
Author

Export just the store obejcts without creating VueX.Store() has fixed the issue

export default {
state,
mutations,
getters,
actions
}

@guilhermeaugvieira
Copy link

guilhermeaugvieira commented Apr 2, 2021

Thanks by solution, it worked

@thiagoteberga
Copy link

Thanks, it helped me a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants