Skip to content

fix(rstest): resolve node runtime plugin from package#4573

Merged
ScriptedAlchemy merged 8 commits intorstest-pluginfrom
codex/rstest-review-fixes
Mar 19, 2026
Merged

fix(rstest): resolve node runtime plugin from package#4573
ScriptedAlchemy merged 8 commits intorstest-pluginfrom
codex/rstest-review-fixes

Conversation

@ScriptedAlchemy
Copy link
Copy Markdown
Member

Description

Resolve the Node runtime plugin from @module-federation/rstest itself so node-based rstest configs do not require consuming apps to install @module-federation/node directly. This also removes the demo server global process state, combines the branch changesets into one, adds English and Chinese docs pages for rstest, and ignores generated dist-node output.

Related Issue

N/A

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation.

Validation run:

  • pnpm --filter @module-federation/rstest test
  • pnpm --filter @module-federation/rstest build
  • pnpm exec prettier --check on touched files
  • pnpm run ci:local --only=e2e-rstest

Notes:

  • The missing @module-federation/node/runtimePlugin failure is fixed.
  • e2e-rstest still fails in the browser lane because @rstest/core is 0.8.5 while @rstest/browser is 0.8.1, which is pre-existing and outside this branch scope.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 19, 2026

🦋 Changeset detected

Latest commit: 810a35a

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

This PR includes changesets to release 46 packages
Name Type
@module-federation/rstest Patch
@module-federation/runtime Patch
@module-federation/enhanced Patch
@module-federation/rspack Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/sdk Patch
@module-federation/runtime-tools Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/dts-plugin Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/devtools Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
@module-federation/bridge-shared Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/modern-js Patch
@module-federation/modern-js-v3 Patch
@module-federation/retry-plugin Patch
@module-federation/data-prefetch Patch
@module-federation/rsbuild-plugin Patch
@module-federation/error-codes Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/runtime-core Patch
create-module-federation Patch
@module-federation/cli Patch
@module-federation/rspress-plugin Patch
@module-federation/treeshake-server Patch
@module-federation/treeshake-frontend Patch
@module-federation/metro Patch
@module-federation/metro-plugin-rnef Patch
@module-federation/metro-plugin-rnc-cli Patch
@module-federation/esbuild Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/storybook-addon Patch
shared-tree-shaking-no-server-host Patch
shared-tree-shaking-no-server-provider Patch
@module-federation/utilities Patch
remote5 Patch
remote6 Patch
shared-tree-shaking-with-server-host Patch
shared-tree-shaking-with-server-provider Patch
website-new Patch
node-dynamic-remote-new-version Patch
node-dynamic-remote 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

const NODE_RUNTIME_PLUGIN = '@module-federation/node/runtimePlugin';
const require = createRequire(import.meta.url);
const NODE_RUNTIME_PLUGIN =
require.resolve('@module-federation/node/runtimePlugin');
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

dont need require.resolve for it. canjust pass the string as the path cant we?

return typeof runtimePlugin === 'string' ? runtimePlugin : runtimePlugin[0];
};

const normalizeRuntimePlugin = (
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

no need for normalization


const existingRuntimePlugins = toArray(merged.runtimePlugins);
if (!existingRuntimePlugins.includes(NODE_RUNTIME_PLUGIN)) {
const existingRuntimePlugins = toArray(merged.runtimePlugins).map(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

assume there wont be existing runtime plugin, maybe just warning if there is since we shoul dbe managing it internally only and user neever need to

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 19, 2026

Open in StackBlitz

@module-federation/devtools

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/devtools@9ce1411

@module-federation/cli

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/cli@9ce1411

create-module-federation

pnpm add https://pkg.pr.new/module-federation/core/create-module-federation@9ce1411

@module-federation/data-prefetch

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/data-prefetch@9ce1411

@module-federation/dts-plugin

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/dts-plugin@9ce1411

@module-federation/enhanced

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/enhanced@9ce1411

@module-federation/error-codes

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/error-codes@9ce1411

@module-federation/esbuild

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/esbuild@9ce1411

@module-federation/managers

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/managers@9ce1411

@module-federation/manifest

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/manifest@9ce1411

@module-federation/metro

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/metro@9ce1411

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

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/metro-plugin-rnc-cli@9ce1411

@module-federation/metro-plugin-rnef

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/metro-plugin-rnef@9ce1411

@module-federation/modern-js

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/modern-js@9ce1411

@module-federation/modern-js-v3

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/modern-js-v3@9ce1411

@module-federation/native-federation-tests

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/native-federation-tests@9ce1411

@module-federation/native-federation-typescript

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/native-federation-typescript@9ce1411

@module-federation/nextjs-mf

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/nextjs-mf@9ce1411

@module-federation/node

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/node@9ce1411

@module-federation/retry-plugin

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/retry-plugin@9ce1411

@module-federation/rsbuild-plugin

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/rsbuild-plugin@9ce1411

@module-federation/rspack

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/rspack@9ce1411

@module-federation/rspress-plugin

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/rspress-plugin@9ce1411

@module-federation/rstest

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/rstest@9ce1411

@module-federation/runtime

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/runtime@9ce1411

@module-federation/runtime-core

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/runtime-core@9ce1411

@module-federation/runtime-tools

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/runtime-tools@9ce1411

@module-federation/sdk

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/sdk@9ce1411

@module-federation/storybook-addon

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/storybook-addon@9ce1411

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

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/third-party-dts-extractor@9ce1411

@module-federation/treeshake-frontend

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/treeshake-frontend@9ce1411

@module-federation/treeshake-server

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/treeshake-server@9ce1411

@module-federation/typescript

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/typescript@9ce1411

@module-federation/utilities

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/utilities@9ce1411

@module-federation/webpack-bundler-runtime

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/webpack-bundler-runtime@9ce1411

@module-federation/bridge-react

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/bridge-react@9ce1411

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

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/bridge-react-webpack-plugin@9ce1411

@module-federation/bridge-shared

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/bridge-shared@9ce1411

@module-federation/bridge-vue3

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/bridge-vue3@9ce1411

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

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

commit: 9ce1411

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: a1c52313b1

ℹ️ 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 on lines +42 to +43
const NODE_RUNTIME_PLUGIN =
require.resolve('@module-federation/node/runtimePlugin');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Guard runtime plugin resolution against missing dist artifacts

Resolve @module-federation/node/runtimePlugin lazily or with a fallback instead of at module load time. This eager require.resolve(...) throws MODULE_NOT_FOUND in clean workspace checkouts where @module-federation/node hasn’t been built yet (its export points at dist/src/runtimePlugin.js), so importing @module-federation/rstest fails before federation() runs—even for browser-target usage that doesn’t need the Node runtime plugin.

Useful? React with 👍 / 👎.

@ScriptedAlchemy ScriptedAlchemy merged commit c6f6220 into rstest-plugin Mar 19, 2026
13 of 16 checks passed
@ScriptedAlchemy ScriptedAlchemy deleted the codex/rstest-review-fixes branch March 19, 2026 22:22
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.

1 participant