perf(frontend): unshare lucide-react over Module Federation#2516
Merged
Conversation
lucide-react was a Module Federation shared singleton in the console remote. Sharing a package as a singleton forces its whole entry (all ~1700 icon modules, ~1.5 MiB) into the shared chunk regardless of how few icons are used, because the shared module is the package entry and any consumer might import any icon. lucide-react is stateless SVG components with no context or hooks, so unlike react/react-dom/@tanstack/react-query/react-router it has no singleton requirement. Removing it from `shared` lets this remote tree-shake to only the icons it imports (184 named import sites, no barrels) and upgrade lucide independently of the cloud-ui host. When loaded with a host that no longer provides lucide, this remote uses its own bundled copy (safe for stateless components). The cloud-ui host and the adp-ui remote unshare it in the cloudv2 repo, so no full lucide copy remains in the embedded scene. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jvorcak
approved these changes
Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stop sharing lucide-react over Module Federation
lucide-reactis a Module Federation shared singleton in this remote(
singleton: true, eager: false). Sharing a package as a singleton forces itsentire entry into the shared chunk — all ~1700 icon modules (~1.5 MiB) —
regardless of how few icons are used, because the shared module is the package
entry and any consumer might import any icon.
lucide-reactis stateless SVG components (no context/hooks), so — unlikereact / react-dom / @tanstack/react-query / @tanstack/react-router — it has no
singleton requirement. Removing it from
shared:When embedded in a host that no longer provides lucide, this remote uses its own
bundled copy — safe, because the components are stateless (no two-instance hazard
like hooks/context).
Coordinated change
The cloud-ui host and the adp-ui remote unshare lucide in the cloudv2 repo
(redpanda-data/cloudv2#27233), so once all three land, no full lucide copy
exists in the embedded scene — each app ships only the icons it uses.
Verified: MF config lints clean (ultracite). Full build/e2e validated by CI.
🤖 Generated with Claude Code