turbo icon indicating copy to clipboard operation
turbo copied to clipboard

Module Federation Support

Open MarwenLabidi opened this issue 2 years ago • 1 comments

Which project is this feature idea for?

Turborepo

Describe the feature you'd like to request

We would like to request support for module federation in turbo packs.

Module federation is a powerful feature for building highly scalable web applications and web sites, as it allows for dynamic loading of modules across different domains. This would enable developers to create applications that are more modular and flexible, and would allow them to benefit from the advantages of a distributed architecture.

We believe that adding support for module federation to turbo packs would make them even more powerful and useful for developers, and would further improve the development experience.

We look forward to your response.

Thank you!

Describe the solution you'd like

In order to implement module federation in turbo packs, the following steps would need to be taken:

  1. Introduce a build step that would enable developers to compile their code into modules for loading with module federation.

  2. Implement a module registry that would serve as a central point for storing and retrieving modules.

  3. Update the turbo pack server to include an API for loading and registering modules. This could be done by adding a special endpoint that would be used for requesting modules from the module registry.

  4. Add support for loading modules from the module registry into the client-side code. This could be done by adding a function for the client-side code to request the modules from the server-side.

  5. Update the turbo pack server to enable developers to integrate the module federation code into their applications. This could be done by adding a special endpoint that would be used for integrating the module federation code into the application.

We hope this helps and we look forward to hearing your response!

Describe alternatives you've considered

We have considered alternatives to module federation such as using a monolithic application architecture. However, using a monolithic architecture would not provide the same scalability and flexibility that module federation offers. Additionally, it would be more challenging to maintain and update the application over time, as changes would need to be made to the entire application as a whole.

PACK-2503

MarwenLabidi avatar Jan 03 '23 10:01 MarwenLabidi

I'd started a discussion about this back in October as well: https://github.com/vercel/turbo/discussions/2348

I'd be interested in helping support this effort if I could but would prefer to have some direction from some more active maintainers before I try to put in effort of that level.

Is module federation something that will be considered with turbopack?

slinkardbrandon avatar May 03 '23 22:05 slinkardbrandon