angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Discovering and loading NgModule at runtime.

Open pdelorme opened this issue 9 years ago • 2 comments

Feature Request

Initially posted in https://github.com/angular/angular/issues/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.

pdelorme avatar Aug 17 '17 07:08 pdelorme

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.

hansl avatar Aug 22 '17 22:08 hansl

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.