Skip to content

Solution for Smaller Unit Development (Lazy Compile Per Module or isolated app - but without the cost of micro front-end) #21123

Closed
@Jonathan002

Description

@Jonathan002

🚀 Feature request

Command (mark with an x)

  • new
  • build
  • [ x] serve
  • test
  • e2e
  • [x ] generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Description

A very large Angular App can take several minutes to compile, when only a Unit Module or Feature is needed for development. (E.g. Imagine Compiling all of Angular Material Components when only 1 material component module needs development.)

There have been proposed solutions that allow faster compile/development such as Micro Front Ends (Where a large app is broken into smaller embedded apps in the view). Although it is very wrong performance wise to have multiple angular apps in 1 view. (e.g. why bootstrap angular 5 times if the web app view used 5 micro front ends?)

https://speakerdeck.com/naltatis/bye-bye-frontend-monolith-accelerating-feature-development-with-micro-frontends?slide=36

Describe the solution you'd like

Allow developers to ng serve a spec file (single / module scoped) for development (in compile isolation to the rest of the app - the server can be reached via browser to view development results). A spec file should contain mock data needed to bootstrap itself to a micro app for development.

Below are 2 approches:

A: Unit Testing UI but for Development with Lazy Compile
I would like a feature where the angular cli has a navigatable UI environment (like how karama test runner opens the browser)
and allows us to choose Unit Testable modules for development work. Only the module selected is lazy compiled and it is fast to get up and running with development.

B: ng serve command per module
ng serve moduleName
The command can open a micro-app for unit development and faster compilation.


Angular is considered to be quite heavy that it is suggested to try other frameworks when using the micro front end pattern:

https://speakerdeck.com/naltatis/bye-bye-frontend-monolith-accelerating-feature-development-with-micro-frontends?slide=59

If a dev team decides to convert lazy route navigation into micro front ends as well, it really feels like we loose the benefit of a SPA if each new route has to get a new html document and bootstrap all over again, instead of updating the DOM quickly (if user goes back and forth multiple times)

We should seek to isolate in dev apps during development but still ship a single app that gives us the performance and speed of a SPA.

Describe alternatives you've considered

Have you considered any alternative solutions or workarounds?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions