[Aurelia 1] Lazily resolve a module by name

Greetings.

We use Aurelia 1 + dumber bundler.

We have a module which has rather heavy dependencies which we keep in a separate bundle, so in some cases we want to load it lazily.
This means NOT using import to import its constructor.
The module itself has some dependencies resolved via resolve(Dependency).

I tried the following approaches:

  • Loader via loader.load("./path/to/module"): this loads the whole module of which the class constructor is a property; this is not enough because we cannot construct an instance
  • Container via container.get("./path/to/module"): this seems allowed by TypeScript but it does not work since it just resolves the passed string (I reiterate, we do not have access to the constructor function here).

Therefore, is there any way to lazily resolve a module by name without explicitly requiring it? (This is conceptually similar to what the router does with page paths.)

This can be disregared, I have found a way to lazy-load not our module but its heavy dependency via loader.load.
I am leaving this open in case someone needs this.

yes loader.load is the way to go for v1, it’s a public API.