Skip to content

fix(storybook-addon): pass through Rsbuild federation options#4768

Merged
2heal1 merged 4 commits into
mainfrom
fix/storybook-rsbuild-mf-options-passthrough
May 29, 2026
Merged

fix(storybook-addon): pass through Rsbuild federation options#4768
2heal1 merged 4 commits into
mainfrom
fix/storybook-rsbuild-mf-options-passthrough

Conversation

@ScriptedAlchemy
Copy link
Copy Markdown
Member

Summary

  • Pass the full Rsbuild Module Federation options object through the Storybook addon preset instead of selecting only name/remotes/shared/shareStrategy.
  • Preserve addon React singleton defaults while allowing advanced options such as dts.consumeTypes.remoteTypeUrls, manifest, and runtimePlugins to reach @module-federation/enhanced/rspack.
  • Add a regression test for dts/manifest/runtimePlugins pass-through and a changeset for @module-federation/storybook-addon.

Why

The previous #4767 fallback fix was too broad: manifest remotes should not automatically guess convention type URLs on manifest failures. The immediate Storybook addon bug is that its Rsbuild adapter discards the exact dts options users need to configure explicit type URLs.

Refs #4759.

Validation

  • pnpm --filter @module-federation/storybook-addon exec jest src/utils/with-module-federation-enhanced-rsbuild.spec.ts --config jest.config.ts --runInBand
  • pnpm --filter @module-federation/storybook-addon run test
  • pnpm --filter @module-federation/storybook-addon run build
  • pnpm exec prettier --check packages/storybook-addon/preset.ts packages/storybook-addon/src/utils/with-module-federation-enhanced-rsbuild.ts packages/storybook-addon/src/utils/with-module-federation-enhanced-rsbuild.spec.ts .changeset/tough-storybook-options.md
  • git diff --check

Skipped checks

  • Full workspace package build/test/lint: skipped because this PR only touches @module-federation/storybook-addon and its changeset; targeted package test/build plus pre-commit lint covered the changed package.
  • dts-plugin tests: skipped because this PR intentionally does not change dts-plugin fallback behavior.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 28, 2026

🦋 Changeset detected

Latest commit: 0f42df5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@module-federation/storybook-addon Patch

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

@netlify
Copy link
Copy Markdown

netlify Bot commented May 28, 2026

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 0f42df5
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/6a18d0a29bf0770008c76845
😎 Deploy Preview https://deploy-preview-4768--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9026f66651

ℹ️ 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".

Comment thread packages/storybook-addon/src/utils/with-module-federation-enhanced-rsbuild.ts Outdated
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 28, 2026

Open in StackBlitz

@module-federation/devtools

pnpm add https://pkg.pr.new/@module-federation/devtools@0f42df5

@module-federation/cli

pnpm add https://pkg.pr.new/@module-federation/cli@0f42df5

create-module-federation

pnpm add https://pkg.pr.new/create-module-federation@0f42df5

@module-federation/dts-plugin

pnpm add https://pkg.pr.new/@module-federation/dts-plugin@0f42df5

@module-federation/enhanced

pnpm add https://pkg.pr.new/@module-federation/enhanced@0f42df5

@module-federation/error-codes

pnpm add https://pkg.pr.new/@module-federation/error-codes@0f42df5

@module-federation/esbuild

pnpm add https://pkg.pr.new/@module-federation/esbuild@0f42df5

@module-federation/managers

pnpm add https://pkg.pr.new/@module-federation/managers@0f42df5

@module-federation/manifest

pnpm add https://pkg.pr.new/@module-federation/manifest@0f42df5

@module-federation/metro

pnpm add https://pkg.pr.new/@module-federation/metro@0f42df5

@module-federation/metro-plugin-rnc-cli

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnc-cli@0f42df5

@module-federation/metro-plugin-rnef

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnef@0f42df5

@module-federation/metro-plugin-rock

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rock@0f42df5

@module-federation/modern-js

pnpm add https://pkg.pr.new/@module-federation/modern-js@0f42df5

@module-federation/modern-js-v3

pnpm add https://pkg.pr.new/@module-federation/modern-js-v3@0f42df5

@module-federation/native-federation-tests

pnpm add https://pkg.pr.new/@module-federation/native-federation-tests@0f42df5

@module-federation/native-federation-typescript

pnpm add https://pkg.pr.new/@module-federation/native-federation-typescript@0f42df5

@module-federation/nextjs-mf

pnpm add https://pkg.pr.new/@module-federation/nextjs-mf@0f42df5

@module-federation/node

pnpm add https://pkg.pr.new/@module-federation/node@0f42df5

@module-federation/observability-plugin

pnpm add https://pkg.pr.new/@module-federation/observability-plugin@0f42df5

@module-federation/retry-plugin

pnpm add https://pkg.pr.new/@module-federation/retry-plugin@0f42df5

@module-federation/rsbuild-plugin

pnpm add https://pkg.pr.new/@module-federation/rsbuild-plugin@0f42df5

@module-federation/rspack

pnpm add https://pkg.pr.new/@module-federation/rspack@0f42df5

@module-federation/rspress-plugin

pnpm add https://pkg.pr.new/@module-federation/rspress-plugin@0f42df5

@module-federation/runtime

pnpm add https://pkg.pr.new/@module-federation/runtime@0f42df5

@module-federation/runtime-core

pnpm add https://pkg.pr.new/@module-federation/runtime-core@0f42df5

@module-federation/runtime-tools

pnpm add https://pkg.pr.new/@module-federation/runtime-tools@0f42df5

@module-federation/sdk

pnpm add https://pkg.pr.new/@module-federation/sdk@0f42df5

@module-federation/storybook-addon

pnpm add https://pkg.pr.new/@module-federation/storybook-addon@0f42df5

@module-federation/third-party-dts-extractor

pnpm add https://pkg.pr.new/@module-federation/third-party-dts-extractor@0f42df5

@module-federation/treeshake-frontend

pnpm add https://pkg.pr.new/@module-federation/treeshake-frontend@0f42df5

@module-federation/treeshake-server

pnpm add https://pkg.pr.new/@module-federation/treeshake-server@0f42df5

@module-federation/typescript

pnpm add https://pkg.pr.new/@module-federation/typescript@0f42df5

@module-federation/utilities

pnpm add https://pkg.pr.new/@module-federation/utilities@0f42df5

@module-federation/webpack-bundler-runtime

pnpm add https://pkg.pr.new/@module-federation/webpack-bundler-runtime@0f42df5

@module-federation/bridge-react

pnpm add https://pkg.pr.new/@module-federation/bridge-react@0f42df5

@module-federation/bridge-react-webpack-plugin

pnpm add https://pkg.pr.new/@module-federation/bridge-react-webpack-plugin@0f42df5

@module-federation/bridge-shared

pnpm add https://pkg.pr.new/@module-federation/bridge-shared@0f42df5

@module-federation/bridge-vue3

pnpm add https://pkg.pr.new/@module-federation/bridge-vue3@0f42df5

@module-federation/inject-external-runtime-core-plugin

pnpm add https://pkg.pr.new/@module-federation/inject-external-runtime-core-plugin@0f42df5

commit: 0f42df5

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

Bundle Size Report

13 package(s) changed, 28 unchanged.

Package dist + ESM entry

Package Total dist (raw) Delta ESM gzip Delta
@module-federation/cli 26.3 kB no change 786 B no change
@module-federation/core 39.1 kB no change 173 B no change
@module-federation/devtools 664.0 kB no change 4.0 kB no change
@module-federation/enhanced 807.9 kB no change 672 B no change
@module-federation/managers 69.8 kB no change 334 B no change
@module-federation/manifest 136.1 kB no change 182 B no change
@module-federation/metro-plugin-rnc-cli 0 B no change 314 B no change
@module-federation/node 193.4 kB no change 217 B no change
@module-federation/rspress-plugin 19.9 kB +8.7 kB (+76.9%) 4.6 kB +1.7 kB (+59.2%)
@module-federation/runtime 20.0 kB -13 B (-0.1%) 715 B no change
@module-federation/runtime-tools 7.7 kB -65 B (-0.8%) 142 B no change
@module-federation/storybook-addon 78.6 kB +747 B (+0.9%) 100 B no change
@module-federation/utilities 110.6 kB no change 328 B no change

Bundle targets

Package Web bundle (gzip) Delta Node bundle (gzip) Delta
@module-federation/cli 2.3 kB -29 B (-1.2%) 2.3 kB -29 B (-1.2%)
@module-federation/core 1.1 kB -30 B (-2.7%) 1.0 kB -29 B (-2.7%)
@module-federation/devtools 30.2 kB -27 B (-0.1%) 30.2 kB -27 B (-0.1%)
@module-federation/enhanced 2.6 kB -43 B (-1.6%) 2.6 kB -43 B (-1.6%)
@module-federation/managers 2.4 kB -26 B (-1.0%) 2.4 kB -26 B (-1.0%)
@module-federation/manifest 6.1 kB -39 B (-0.6%) 6.1 kB -39 B (-0.6%)
@module-federation/metro-plugin-rnc-cli 411 B -25 B (-5.7%) 411 B -25 B (-5.7%)
@module-federation/node 9.2 kB -27 B (-0.3%) 9.2 kB -27 B (-0.3%)
@module-federation/rspress-plugin 3.2 kB +1.1 kB (+51.3%) 3.2 kB +1.1 kB (+51.3%)
@module-federation/runtime 687 B no change 687 B no change
@module-federation/runtime-tools 89 B no change 89 B no change
@module-federation/storybook-addon 1.9 kB -24 B (-1.2%) 1.7 kB -24 B (-1.3%)
@module-federation/utilities 2.6 kB -31 B (-1.2%) 2.6 kB -31 B (-1.2%)

Consumer scenarios

Scenario Web output (gzip) Delta Node output (gzip) Delta Gap (node-web) Delta
Enhanced remoteEntry 21.4 kB -9 B (-0.0%) 22.5 kB -12 B (-0.1%) +1.1 kB -3 B

Total dist (raw): 6.80 MB (+9.3 kB (+0.1%))
Total ESM gzip: 78.3 kB (+1.7 kB (+2.2%))
Total web bundle (gzip): 206.5 kB (+796 B (+0.4%))
Total node bundle (gzip): 207.0 kB (+797 B (+0.4%))
Tracked ./bundler entry gzip: 556 B (no change)
Tracked ./bundler web bundle (gzip): 4.8 kB (no change)
Tracked ./bundler node bundle (gzip): 4.8 kB (no change)

Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as ./bundler are measured separately so ENV_TARGET-driven tree-shaking is visible. Bare imports are externalized to keep package-level sizes consistent, and assets are emitted as resources.

ScriptedAlchemy added 3 commits May 28, 2026 02:35
…hema rejection

Storybook passes its full Options object (configDir, presets, cache,
features, packageJson, port, ...) into the rsbuildFinal hook. The enhanced
ModuleFederationPlugin schema is strict (additionalProperties: false), so the
previous denylist (stripping only 4 keys) let other Storybook metadata leak
through and fail validation, breaking Storybook startup. Filter to a
compile-time-checked allowlist of valid Module Federation option keys instead.
@2heal1 2heal1 merged commit 5a8db3e into main May 29, 2026
27 checks passed
@2heal1 2heal1 deleted the fix/storybook-rsbuild-mf-options-passthrough branch May 29, 2026 02:33
@2heal1 2heal1 mentioned this pull request Jun 4, 2026
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.

2 participants