Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nf): use native federation with ng builder instead of adapter #588

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aasereb7
Copy link

@aasereb7 aasereb7 commented Jun 27, 2024

As long as native federation is a great idea i see great performance and architectural issue using literally 2 builders at once (app builder and adapter)

For example my app code:

  1. would build at 10 seconds
  2. I would see all the build artefacts, loaders etc
  3. rebuild would call page reload when serve

All the federation artefacts (node packages, exposes, non-buildable libs etc) would built in other proccess:

  1. in unknown time (we can put a timestamp on that, but that is not the point)
  2. with unknown artefacts
  3. with no loaders
  4. rebuild when serve would not call page reload
  5. rebuild when serve will take incredible amount of time compared to main build
    • thats because of initiating esbuild on each change, which took up to 10-15 seconds on a big projects

I spent some amount of time thinking if i could do something about it and this PR is the result, i tried to leave comment on each potentially non-obvious line

Main idea is:

  1. use NF to calc all the federation artefacts and create mappings (remoteEntry.json)
  2. set ng builder to build both the app code (excluding NF artefacts) and all the calculated files
  3. handle runtime pretty much same as it was earlier except NF files when serve (dev server can handle them like all the others now)

If you try it out you'll see:

  1. build
    2. pretty much the same speed
    3. correct files and artefacts in console
  2. serve
    3. same as build on start
    4. faster rebuilds
    5. transparent data in console
    6. nice page reloading on edit any artefacts

One more thing - i understand that it is not a prod-ready code. Right now it's more about to validate if this idea has right to live, or is it failure even on PoC stage)

It would be my personal great achievement if this PR would be accepted. Appreciate any comments, thoughts, questions or additions, thank you in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant