Skip to content

feat: migrate the Modern.js addon to @modern-js/storybook-addon - #651

Draft
zllkjc wants to merge 1 commit into
rstackjs:v4from
zllkjc:codex/modernjs-addon-migration
Draft

zllkjc wants to merge 1 commit into
rstackjs:v4from
zllkjc:codex/modernjs-addon-migration

Conversation

@zllkjc

@zllkjc zllkjc commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary / 变更摘要

Keep this PR in draft until Modern.js publishes a compatible addon and the release checks below pass. 等待 Modern.js 发布兼容版本并完成下方验证后再合并。 Modern.js PR #9205

English 中文
Remove storybook-addon-modernjs from the workspace and release set. Retire the React integration tests and their test-only config now covered upstream. 移除本仓库原 addon 及其发布入口,清理已由上游接手的 React 集成测试与测试专用配置。
Keep both examples. The React example and Module Federation host use @modern-js/storybook-addon@latest and depend directly on the v4 workspace builder. Keep the separate federated-remote browser test. 保留两个示例。React 示例和 Module Federation host 均使用 @modern-js/storybook-addon@latest,并显式依赖工作区的 v4 builder。继续测试浏览器从远端加载联邦组件。
Update both language guides, including installation, preset registration, Module Federation setup and migration from the old package. 同步更新中英文安装、addon 注册、Module Federation 配置和旧包迁移说明。

Compatibility

The upstream fixture registers appTools() and bffPlugin(). The addon calls the public resolveModernRsbuildConfig({ command: 'storybook' }), merges shared and client settings, and calls the builder’s stripInheritedConfig. With the current example lock (@modern-js/app-tools@3.10.0), that resolver returned the React example’s @my-src alias. Both examples loaded the preset with the v4 workspace builder. Upstream fixture · Upstream preset

The current upstream builder peer is ~3.6.3. This branch uses 4.0.0-beta.0 with Storybook 11.0.0-beta.3. The addon also requests Rsbuild ^2.3.2 and the matching Modern.js app-tools release. The examples currently lock Rsbuild 2.2.13. Confirm published peer support before merging. Upstream peer dependencies

Local validation

Built the addon from Modern.js commit 8045619 and placed its package files in the two examples’ local node_modules for runtime checks. The local checkout used this branch’s builder and framework throughout.

  • pnpm check, pnpm check-dependency-version and pnpm --filter website build passed.
  • pnpm build:sandboxes built all 13 Storybooks. The React example also rendered the AntdButton docs and the myButtonExtra prop in Chrome using its dev server.
  • pnpm test passed all 232 tests. pnpm build:test passed. pnpm e2e --retries=0 --workers=3 passed all 23 tests, including the Module Federation host loading RemoteButton. The normal pnpm build passed afterward.

Before merging / 合并前

  • Wait for a release of @modern-js/storybook-addon on the npm latest tag whose builder peer includes v4. Align the Modern.js and Rsbuild resolutions with the published peer ranges.
  • Run pnpm install and commit the resulting pnpm-lock.yaml. The current lockfile prunes the retired workspace package and links the examples to the local builder. The new package is still missing from npm (ERR_PNPM_FETCH_404), so a clean frozen install currently reports ERR_PNPM_OUTDATED_LOCKFILE.
  • From a fresh checkout, run pnpm install --frozen-lockfile, rerun the checks above with the registry package, and confirm both examples before marking this PR ready.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant