Skip to content

Discovering and loading NgModule at runtime. #7405

Closed

Description

@pdelorme

Feature Request

Initially posted in angular/angular#18053 and moved here.

Current behavior

It is not possible to load dynamicall NgModules that have not been compiled at the same time of the whole application.
Angular-cli and webpack currently requier all code and modules used by the application in order to best optimize the production files. It does split the application into chunks corresponding to dynamic NgModules, but chunks are closely linked together.

Expected behavior

There should be an Option in angular-cli/webpack that allow independancy and reuse of chunks it generates even though final result is less optimal regarding code size and optimization.

I believe, Dynamic Loading of NgModule has been designed with this idea in mind since it doesn't requier NgModules to be statically imported in the router. This idea seem to have been lost in the race for perfect optimization (which is great by the way).

What is the motivation / use case for changing the behavior?

Actual trend is to do MicroService that encapsulate complete buisness behaviour and interface. This allows to developp and upgrade part of large application without the need to re-compile and redeploy the wole lot. Angular should take this into account and allow NgModules exposed in different micro-serviceto be discovered and loader at run time.

Activity

  1. hansl commented on Aug 22, 2017

    @hansl
    Contributor

    This is not CLI specific, and unfortunately there's nothing we will do. The CLI does not support building libraries or individual application parts (like "just" a NgModule).

    I'll talk to @robwormald who's worked with similar setup in the past and we will answer this in the Angular repo (or elsewhere if it doesn't fit in either). Leaving this open in the meantime to keep the discussion around.

  2. removed their assignment
    on Feb 6, 2018
  3. angular-automatic-lock-bot commented on Sep 9, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  4. locked and limited conversation to collaborators on Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions