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: support Module Federation format #240

Merged
merged 48 commits into from
Oct 18, 2024
Merged

feat: support Module Federation format #240

merged 48 commits into from
Oct 18, 2024

Conversation

nyqykk
Copy link
Member

@nyqykk nyqykk commented Sep 27, 2024

Summary

Add format called 'mf' to build Module Federation assets and add example for both host and remote scene in rslib

closes: #212

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copy link

netlify bot commented Sep 27, 2024

Deploy Preview for rslib ready!

Name Link
🔨 Latest commit f28da36
🔍 Latest deploy log https://app.netlify.com/sites/rslib/deploys/6712286d6227610008f8aa00
😎 Deploy Preview https://deploy-preview-240--rslib.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@fi3ework fi3ework marked this pull request as draft September 27, 2024 04:13
examples/mf-host/@mf-types/index.d.ts Outdated Show resolved Hide resolved
packages/plugin-module-federation/package.json Outdated Show resolved Hide resolved
packages/plugin-module-federation/src/cli/index.ts Outdated Show resolved Hide resolved
@fi3ework
Copy link
Member

@nyqykk Let’s keep pushing this PR.

@nyqykk
Copy link
Member Author

nyqykk commented Oct 10, 2024

@nyqykk Let’s keep pushing this PR.

i write a rsbuild plugin in mf repo, for both app project and rslib which is build by rsbuild, so this branch will be changed
module-federation/core#3062

examples/mf-host/.gitignore Outdated Show resolved Hide resolved
examples/mf-host/package.json Outdated Show resolved Hide resolved
examples/mf-remote/package.json Outdated Show resolved Hide resolved
examples/react-component/package.json Outdated Show resolved Hide resolved
packages/plugin-dts/package.json Outdated Show resolved Hide resolved
Copy link

codspeed-hq bot commented Oct 11, 2024

CodSpeed Performance Report

Merging #240 will improve performances by 69.49%

Comparing feat/support-mf (f28da36) with main (760968b)

Summary

⚡ 1 improvements
✅ 3 untouched benchmarks

🆕 1 new benchmarks

Benchmarks breakdown

Benchmark main feat/support-mf Change
🆕 examples/module-federation/mf-react-component N/A 356 ms N/A
examples/react-component-bundle-false 298.2 ms 176 ms +69.49%

@nyqykk nyqykk marked this pull request as ready for review October 11, 2024 08:39
@Timeless0911 Timeless0911 changed the title [WIP]feat: support Module Federation format feat: support Module Federation format Oct 11, 2024
Timeless0911
Timeless0911 previously approved these changes Oct 11, 2024
Copy link
Contributor

@Timeless0911 Timeless0911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the initial implementation, we can continue to iterate and improve it in later PRs.

examples/module-federation/mf-react-component/package.json Outdated Show resolved Hide resolved
packages/core/src/utils/helper.ts Outdated Show resolved Hide resolved
packages/core/src/utils/helper.ts Outdated Show resolved Hide resolved
website/docs/en/guide/advanced/module-federation.mdx Outdated Show resolved Hide resolved
website/docs/zh/guide/advanced/module-federation.mdx Outdated Show resolved Hide resolved
website/docs/zh/guide/advanced/module-federation.mdx Outdated Show resolved Hide resolved
website/docs/zh/guide/advanced/module-federation.mdx Outdated Show resolved Hide resolved
website/docs/zh/guide/advanced/module-federation.mdx Outdated Show resolved Hide resolved
website/docs/en/guide/advanced/module-federation.mdx Outdated Show resolved Hide resolved
@nyqykk nyqykk enabled auto-merge (squash) October 18, 2024 07:55
.changeset/sharp-kiwis-own.md Outdated Show resolved Hide resolved
packages/core/src/config.ts Show resolved Hide resolved
packages/core/src/config.ts Outdated Show resolved Hide resolved
examples/module-federation/mf-host/README.md Outdated Show resolved Hide resolved
@fi3ework
Copy link
Member

Generally LGTM. 👍

@fi3ework
Copy link
Member

Append examples/module-fedration/mf-react-component to https://github.com/web-infra-dev/rslib/blob/main/tests/benchmark/index.bench.ts then we're good to merge.

You could remove the 'esm' and 'cjs' lib from the config like what disableDts does. This could help us only foucs on measure the benchmark of MF bundling. disableDts should also be applied as well.

@fi3ework
Copy link
Member

The benchmark shows examples/react-component-bundle-false got improved, but it should be irrelevant. cc @SoonIter any idea?
image

@nyqykk nyqykk merged commit d362cdb into main Oct 18, 2024
18 checks passed
@nyqykk nyqykk deleted the feat/support-mf branch October 18, 2024 09:35
@fi3ework
Copy link
Member

Great work!

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

Successfully merging this pull request may close these issues.

[Feature]: Support for Module Federation
5 participants