Skip to content

Question/Bug? - having manifests calculated dynamically breaks build #10

@DmitryEfimenko

Description

@DmitryEfimenko

I have a case when I want to introduce a convention where all my dynamic modules/components will be in dynamic-modules folder. So instead of

const manifests: DynamicComponentManifest[] = [
  {
    componentId: 'message',
    path: 'dynamic-message', // some globally-unique identifier, used internally by the router
    loadChildren: './dynamic-modules/message/message.module#MessageModule',
  },
  {
    componentId: 'dialog',
    path: 'dialog',
    loadChildren: './dynamic-modules/dialog/dialog.module#DialogModule',
  },
];

... wrote this:

const ids = ['feature1', 'feature2', 'feature3'];
export const manifests: DynamicComponentManifest[] = ids.map(id => {
  const m: DynamicComponentManifest = {
    componentId: id,
    path: id,
    loadChildren: `./dynamic-modules/${id}/${id}.module#${capitalizeFirstLetter(id)}Module`
  };
  return m;
});
// ... later in module imports:
DynamicComponentLoaderModule.forRoot(manifests),

At build time I get an error:

ERROR in Cannot read property 'loadChildren' of undefined

Do you have any idea how to fix that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions