Is it possible to split a module into multiple files?
It is common to write a Vuex module with 5 files where you have module.state.ts, module.getters.ts, module.mutations.ts, module.actions.ts and module.ts (which assembles the 4 files into the same module).
Not possible with this right now
Closing the issue? Isn't it a possible feature to implement someday?
I don't think it will be possible with the kind of syntax we have. The module class has to be a single file. Otherwise the class decorator will not work.
it is not good that too many code in a single file. 馃槶
Still no work around the use of multiple files for a module?
Hey there, any way to split the module into separate files? This is really needed :/
Hey there, any way to split the module into separate files? This is really needed :/
Well as a work around that I'm using right now is to use a more functional aproach and using helper functions to call methods that are too big to be in that file, so something like:
// helpers.ts
export async function login (request) {
// do stuff and return a promise
}
// auth.ts
import { login } from "./helpers";
@Action
async login(request) {
const res = await login(request);
}
Most helpful comment
it is not good that too many code in a single file. 馃槶