[v6] Drop Module Federation v1 support and migrate fully to v2
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- react-native, typescript, webpack
調査の方向性
まず packages/repack の前提となる依存関係の更新から始め、ModuleFederationPluginV2.ts、FederationRuntimePlugins ディレクトリ、および指定された plugin、utility、app、test、documentation ファイルを確認します。ModuleFederationPluginV2.test.ts と NativeEntryPlugin.test.ts を含む、関連する unit test と integration test を実行します。完了の条件は、V1 のサポートが削除され、V2 がデフォルトかつ維持される alias となり、依存関係とテストがサポート対象の範囲に一致し、app とドキュメントが移行されていることです。
索引モデルが issue の本文から書いたものです。
説明
Motivation
Re.Pack currently ships two Module Federation implementations side by side: ModuleFederationPluginV1 (built on webpack's/Rspack's native container API) and ModuleFederationPluginV2 (built on @module-federation/enhanced). The generic Repack.plugins.ModuleFederationPlugin export still resolves to V1 and logs a notice on every build stating that the next major will repoint it at V2. v6 is that major.
MF v1 is no longer being iterated on upstream — all Module Federation development happens in the @module-federation/* v2 packages. Carrying both implementations doubles the plugin surface, the documentation, the tester apps and the test matrix, and it blocks a set of cleanups that only make sense once V1 is gone.
Part of #1414 (Roadmap to V6), which already lists MF v2+ as a minimum-version target and "updated docs for MF v2" as a deliverable.
Breaking changes
Repack.plugins.ModuleFederationPluginstarts resolving to the V2 implementation. Configs written against the V1 option shape need migrating.ModuleFederationPluginV1is removed.@module-federation/enhancedeffectively becomes a required peer dependency instead of an optional one. V1 needed no extra install; V2 hard-fails without it (ensureModuleFederationPackageInstalledinpackages/repack/src/plugins/ModuleFederationPluginV2.ts).- The build-side
Federatednamespace (createRemote,SHARED_REACT,SHARED_REACT_NATIVEinpackages/repack/src/utils/federated.ts) is removed — it is only consumed by V1.
Scope
Core
- Repoint
ModuleFederationPluginat the V2 implementation and drop thebeforeCompiledeprecation notice inpackages/repack/src/plugins/ModuleFederationPlugin.ts - Keep
ModuleFederationPluginV2exported as an alias so existing v5 configs continue to work unchanged - Remove
packages/repack/src/plugins/ModuleFederationPluginV1.ts, its export fromplugins/index.ts, and its unit tests - Remove
packages/repack/src/utils/federated.tsand its re-export fromutils/index.ts - Decide the fate of the client-side
Federatednamespace (importModule,createURLResolverinpackages/repack/src/modules/ScriptManager/federated.ts) — superseded by the MF v2 resolver runtime plugin, but it is public API and may be used independently of the build plugin - Move
@module-federation/enhancedout ofpeerDependenciesMeta.optionaland raise the peer floor to a 2.x range
Apps and tests
- Migrate
apps/tester-federationto V2, or fold it intoapps/tester-federation-v2and delete it — once both are on V2 they largely duplicate each other, so consolidating into a singletester-federationapp is probably the better outcome - Drop the
with Module Federation v1case intests/integration/src/plugins/NativeEntryPlugin.test.ts - Update the MF version matrix in the same file (currently 0.15.0 / 0.21.0 / 2.0.1) to match the new supported range
Docs
- Remove
website/src/latest/api/plugins/module-federation-v1.mdxand renamemodule-federation-v2.mdxtomodule-federation.mdx - Rewrite
website/src/latest/docs/features/module-federation.md, which currently just redirects readers to the Re.Pack 4.x docs with a caveat that they are out of date - Add an MF v1 → v2 section to the v5 → v6 migration guide
Prerequisite
This depends on first bumping @module-federation/enhanced in packages/repack from 0.8.9 to 2.x. That bump is a small standalone change but does have breakage of its own:
FederationRuntimePluginwas renamed toModuleFederationRuntimePluginandFederationHosttoModuleFederation, affecting all three runtime plugins inpackages/repack/src/modules/FederationRuntimePlugins/runtimePluginswidened to(string | [string, Record<string, unknown>])[], soadaptRuntimePluginsneeds to handle the tuple form — which also unlocks passing options to runtime plugins- the
jest.mock('@module-federation/enhanced/rspack')automock inModuleFederationPluginV2.test.tsno longer produces a constructor and needs an explicit factory
As a bonus, moving to @module-federation/enhanced >= 2.4.0 also releases the webpack hold at ~5.105.0 in pnpm-workspace.yaml, which exists solely because older MF versions depend on a webpack internal removed in 5.106.
- 主要言語
- TypeScript
- スター
- 1.9k
- フォーク
- 164
- 平均マージ
- 10日 13時間
- マージ済み PR(30日)
- 10
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
callstack/repack のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 78/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
-
Dev server progress goes backwards mid-compilation (non-monotonic percentage forwarded to reporters) オープン
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 78/100
-
area:repack type:feature
難易度 5/5 1週間以上 初心者へのやさしさ 42/100
callstack/repack の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
bcgov/bc-wallet-mobile#4761 · コメント 1 件 ·
-
external-issue to-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
area-deployment area-integrations triage:bot-seen
難易度 2/5 半日 初心者へのやさしさ 86/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100