fix(rsbuild-plugin): support app SSR node target with custom environment#4427
fix(rsbuild-plugin): support app SSR node target with custom environment#4427ScriptedAlchemy merged 33 commits intomainfrom
Conversation
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: 80bebe2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 43 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb2b405e83
ℹ️ 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".
Bundle Size Report3 package(s) changed, 38 unchanged.
Total dist: 6.89 MB (+8.3 kB (+0.1%)) |
@module-federation/devtools
@module-federation/cli
create-module-federation
@module-federation/data-prefetch
@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/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: |
Android Release APK for all devicesNote: if the download link expires, please re-run the workflow to generate a new build. Generated at 2026-02-15T21:46:23.410Z UTC |
iOS Release APP for simulatorsNote: if the download link expires, please re-run the workflow to generate a new build. Generated at 2026-02-15T21:51:57.206Z UTC |
…p-ssr-node-env # Conflicts: # apps/metro-example-host/e2e/flows/core.yaml
Resolve the dts-plugin TYPE-001 failure by correcting package entry paths for workspace dependencies and updating RawSource usage for webpack typings. Co-authored-by: Cursor <cursoragent@cursor.com>
Restore sdk and error-codes export paths to the filenames emitted by the current build so CI package resolution no longer fails on these branches. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@cursoragent review and improve implementation. Look for any changes that were scope creep vs original specification or intent of the pr |
|
Findings (ordered by severity):
Summary/notes: I kept node-target processing scoped to the selected environment and reused a cloned SSR MF config for node builds (so shared options stay clean), plus I added assertions to ensure the base MF options remain unmodified in the non-selected env test ( Testing & verification (commands run, in order):
|
Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>


Summary
This PR makes
@module-federation/rsbuild-pluginsupport plugin-only SSR for Rsbuild app mode when usingtarget: 'node'with a customenvironment(for examplessr) without introducing breaking behavior.Problem
Using
pluginModuleFederation(..., { target: 'node', environment: 'ssr' })in app-mode SSR was not reliable:config.environments['mf']isMFFormatgating, which could leavemf_remote/*unresolvedRoot Cause
pluginModuleFederationused a hardcoded env key (mf) instead of the configuredenvironmentoption.onBeforeCreateCompilerreturned early for non-MF-format configs before considering thattarget: 'node'needs to run for the selected environment even when output is commonjs-like.target === 'node' && isMFFormat(...)) rather than constrained to the selected environment.Changes
config.environments[environment].target: 'node'env is missing, including available environment names.environmentbehavior ('mf') unchanged for backward compatibility.target: 'dual'restrictions/behavior intact (no app-modedualenablement in this PR).Tests
Added
/packages/rsbuild-plugin/src/cli/node-target.spec.tscovering:environment: 'ssr') without requiringmftarget: 'dual'restriction remains unchanged for non-Rslib/non-Rspress callersmfenvironment behavior still worksVerification
pnpm -s nx run rsbuild-plugin:testpnpm -s nx run rsbuild-plugin:buildBoth pass.
Docs and Release Notes
packages/rsbuild-plugin/README.mdwith app-mode node target example.apps/website-new/docs/en/guide/build-plugins/plugins-rsbuild.mdxapps/website-new/docs/zh/guide/build-plugins/plugins-rsbuild.mdx.changeset/quick-forks-wonder.md