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.

Split a module into multiple files

See original GitHub issue

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).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
zhenizhuicommented, Oct 9, 2019

it is not good that too many code in a single file. 😭

0reactions
GustavoFenillicommented, Mar 10, 2021

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);
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I split a module into multiple files, without breaking a ...
So my question is: is it possible to split it in multiple files somehow but still referring to them as model.Foo() ? I...
Read more >
Separating Modules into Different Files - The Rust ...
Summary. Rust lets you split a package into multiple crates and a crate into modules so you can refer to items defined in...
Read more >
Python - splitting a module into multiple files - TestDriven.io
Python Clean Code Tip: When your module becomes too big you can restructure it to a package while keeping all the imports from...
Read more >
Day 21: Splitting Code Into Multiple Files - Teclado
Splitting your code into multiple files is a great way to produce smaller, more focused files. Navigating theses smaller files will be easier...
Read more >
Organizing code - Rust Classes
Splitting files into sub-modules. A single Rust file can hold multiple modules. Each module is identified and scoped with a mod {...} statement...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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