InversifyJS
InversifyJS copied to clipboard
Is there any option to asynchronously register a container from a splitted chunk?
I'm building an application by feature modules, so I have something like FeatureModuleA, FeatureModuleB and so on. Every feature module has its own container module. Some of these modules are loaded with lazy loading since they are optional.
Currently, I'm registering the containers as shown below.
import { Container } from 'inversify';
import getDecorators from 'inversify-inject-decorators';
import { ContainerA, ContainerB, ... } from '';
const container = new Container();
container.load(ContainerA, ContainerB, ...);
const { lazyInject } = getDecorators(container);
export { container, lazyInject };
After building the application I can see how the modules are splitted in multiple chunks, however, the providers are still part of the main bundle. So I'm wondering if there exist anyway to asynchronously register a container after loading a splitted chunk?
Maybe you can call getDecorators on child container, then register deps async into parent container?