feat(metro): support manifest hashes for native caching#4700
Conversation
Compute hashes during serialization and thread them through manifest generation so the native cache layer can verify bundle integrity.
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: 974bf2e The changes in this PR will be included in the next version bump. This PR includes changesets to release 45 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Bundle Size Report11 package(s) changed, 29 unchanged. Package dist + ESM entry
Bundle targets
Consumer scenarios
Total dist (raw): 6.25 MB (+25.0 kB (+0.4%)) Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as |
@module-federation/devtools
@module-federation/cli
create-module-federation
@module-federation/dts-plugin
@module-federation/enhanced
@module-federation/error-codes
@module-federation/esbuild
@module-federation/managers
@module-federation/manifest
@module-federation/metro
@module-federation/metro-plugin-rnc-cli
@module-federation/metro-plugin-rnef
@module-federation/metro-plugin-rock
@module-federation/modern-js
@module-federation/modern-js-v3
@module-federation/native-federation-tests
@module-federation/native-federation-typescript
@module-federation/nextjs-mf
@module-federation/node
@module-federation/retry-plugin
@module-federation/rsbuild-plugin
@module-federation/rspack
@module-federation/rspress-plugin
@module-federation/runtime
@module-federation/runtime-core
@module-federation/runtime-tools
@module-federation/sdk
@module-federation/storybook-addon
@module-federation/third-party-dts-extractor
@module-federation/treeshake-frontend
@module-federation/treeshake-server
@module-federation/typescript
@module-federation/utilities
@module-federation/webpack-bundler-runtime
@module-federation/bridge-react
@module-federation/bridge-react-webpack-plugin
@module-federation/bridge-shared
@module-federation/bridge-vue3
@module-federation/inject-external-runtime-core-plugin
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ffc273909
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b58edc8d09
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Description
Builds on top of #4576 to finalize Metro manifest hashes for native cache workflows.
The main change is that manifest hashes are now produced from Metro's serialized bundle output instead of being derived during the earlier manifest generation path. That matters because Metro dev builds lazily compile federated entrypoints, exposes, and shared modules only after they are requested for a platform. Computing hashes from serialization gives us the final emitted bundle content in both production bundling and dev-server requests.
This PR also makes platform-scoped dev manifest requests warm the required federated modules before returning
mf-manifest.json, which enables testing federated module caching during development instead of only after production bundle output exists.In scope:
metroCorePlugin.shared.importresolve through the configured shared key while loading the actual import target.Validation run locally:
pnpm --filter @module-federation/metro run test -- __tests__/plugin/resolver.spec.tspnpm --filter @module-federation/metro run typecheckpnpm --filter @module-federation/metro run lintpnpm --filter @module-federation/metro run buildpnpm --filter @module-federation/metro-plugin-rock run buildpnpm --filter @module-federation/metro-plugin-rock run typecheckpnpm --filter @module-federation/metro-plugin-rock run lintpnpm exec turbo run build --filter=@module-federation/metro-plugin-rockpnpm exec prettier --check .changeset/metro-dev-manifest-hashes.mdgit diff --checkRelated Issue
Follow-up to #4576.
Types of changes
Checklist