maciejtreder / ng-toolkit

:star: Angular tool-box! Start your PWA in two steps! Add Serverless support for existing projects and much more
https://www.angular-universal-pwa.maciejtreder.com
MIT License
1.12k stars 156 forks source link

introduce back external module #150

Open maciejtreder opened 6 years ago

maciejtreder commented 6 years ago

I'm submitting a...


[ x ] Bug report  
[ x ] Feature request
[ ] Documentation issue or request

Current behavior

Lack of support for external modules

Expected behavior

After upgrade to CLI (#144) external module support must be fixed

cgatian commented 6 years ago

I dont recall what external module support was? You briefly talk about it in the README but could you explain a little deeper?

maciejtreder commented 6 years ago

Sure.

In previous versions (when this boilerplate was based on webpack, not CLI) there was a possibility to import external module, written in separate repository, and lazy-load it as a part of the application.

I have done it, as a somekind of 'microservices' structure support. Developer could create services in separated repos with following manner:

then, those /ui part could be installed as a dependency for main application, and included into routing.

Of course, when you are attaching new module, you need to recompile whole app (because of new routing in the main app). But I would like to implement mechanism (so far I don't know how :D ), which could add possibility to simply replace file with external module chunk, when there is such need.

So far, after updating to CLI, I ran into issue with JIT compilation - so decided to remove external module support for now, and bring it back in the future

selipso commented 6 years ago

Not sure if this helps but the new CLI's ng generate library combined with ng add commands might help solve this issue for Angular v6.

maciejtreder commented 6 years ago

@selipso Thank you for this comment. I will check if ng generate library gives us a chance here.