question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do I access one module from another?

See original GitHub issue

Using NuxtJS (with TypeScript) I seem to have to specifically provide the store when I use getModule even though I have not defined my modules as dynamic. I cannot provide the store on the @module statement because I cannot import a store it seems - it isn’t created at the point of the import.

This being so, I have to use getModule(MyModule, this.$store) in my pages/components. So how do I now access (for example) a getter from ModuleB from an action in ModuleA?

I am expecting to do something like this: ModuleA

import ModuleB from './moduleb`;
import { getModule } from 'vuex-module-decorators';

@Action
    public async myAction(payload: IPayload): Promise<void> {
        const moduleB = getModule(ModuleB, <I need the store here>);
        const someModuleBData = moduleB.someModuleBGetter;
    }

Where do I get the store from?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:26 (6 by maintainers)

github_iconTop GitHub Comments

8reactions
kpturnercommented, May 11, 2019

Why was this closed? Is there a solution that is typesafe now?

6reactions
championswimmercommented, Feb 20, 2019

@pranavjindal999 Sounds like a good idea. I will check the feasibility of that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can I access One module site-property from another module
You're best bet is to create a module containing public entity that is referenced by both of your module. Hello, The standard way...
Read more >
How to access a variable from another module? - Stack Overflow
I have a module 'a' in package stack, i imported using the from and import keyword and used this way. from stack import...
Read more >
Call your code from another module
Call your code from another module · Declare a main package. In Go, code executed as an application must be in a main...
Read more >
How to call one module method into another
For complete access to one module's classes and methods from another, you would make the first module a declared dependency of the second...
Read more >
Sharing modules - Angular
It re-exports the CommonModule and FormsModule. By re-exporting CommonModule and FormsModule , any other module that imports this SharedModule , gets access to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found