web-infra-dev / rspack

The fast Rust-based web bundler with webpack-compatible API 🦀️
https://rspack.dev
MIT License
9.33k stars 544 forks source link

Integration of single-spa with rspack for Micro-Frontends #6413

Open douglaszaltron opened 5 months ago

douglaszaltron commented 5 months ago

Description

I'm looking to integrate single-spa into an existing project and utilize rspack to build and package micro-frontends efficiently. Has anyone had experience with this combination and could share examples or insights on how to do this effectively?

Context

We have an existing project where we're exploring the use of micro-frontends for modularity and scalability. We've decided to adopt Module Federation as our micro-frontend framework, and we're also considering using rspack for bundling and optimization. However, we're unsure about the best practices and potential challenges when integrating these two technologies together.

However, we also need to package it for single-spa because there's another one that consumes this application with it. Today, we use Vite to do this.

LingyuCoder commented 5 months ago

cc @zhoushaw @ahabhgk

ahabhgk commented 5 months ago

I don't have experience about single-spa so I can't give any suggestions about best practices. Only for supporting single-spa in Rspack, Rspack should already support it and fully compatible with the configuration required by single-spa: https://github.com/single-spa/create-single-spa/blob/main/packages/webpack-config-single-spa/lib/webpack-config-single-spa.js

ScriptedAlchemy commented 5 months ago

Its more than possible. Since single spa already suggests module federation for many use cases and we support all the build specifications required. You can follow single spa's module federation recipe with rspack and it should work just fine. Alternatively you can put it into systemjs mode, but the module sharing is more robust with federation

zhoushaw commented 3 months ago

https://github.com/module-federation/core/discussions/2519 @douglaszaltron I think you can focus on this rfc, module federation that also supports loading application levels

stale[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!