Skip to content

feat(runtime): expose bundler entrypoints#4526

Merged
ScriptedAlchemy merged 11 commits intomainfrom
codex/runtime-bundler-entrypoints
Mar 12, 2026
Merged

feat(runtime): expose bundler entrypoints#4526
ScriptedAlchemy merged 11 commits intomainfrom
codex/runtime-bundler-entrypoints

Conversation

@ScriptedAlchemy
Copy link
Copy Markdown
Member

@ScriptedAlchemy ScriptedAlchemy commented Mar 11, 2026

Description

Add stable /bundler entrypoints for the runtime packages so bundlers can resolve tree-shakeable ESM entry files without depending on internal dist/index.* paths.

This PR:

  • adds ./bundler exports for @module-federation/runtime
  • adds ./bundler exports for @module-federation/runtime-tools
  • adds ./bundler exports for @module-federation/webpack-bundler-runtime
  • wires the extra bundler build entries into the package build configs

Test plan

  • pnpm exec turbo run build --filter=@module-federation/runtime --filter=@module-federation/runtime-tools --filter=@module-federation/webpack-bundler-runtime --force

PR Stack

This PR is 1/3 in the stack.

Stack order (base -> tip):

  1. #4526 feat(runtime): expose bundler entrypoints (current, base)
  2. #4518 fix(enhanced,sdk,runtime): tree-shake env-target runtime paths
  3. #4527 [codex] improve bundle size reporting for bundled runtime paths (tip)

Navigation:

  • Prev: none (this is the base PR)
  • Next: #4518
  • Stack refs: #4526 -> #4518 -> #4527
  • Branch: codex/runtime-bundler-entrypoints into main

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 11, 2026

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 1451fdd
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/69b231e67d3b9500086fc4b3
😎 Deploy Preview https://deploy-preview-4526--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 11, 2026

⚠️ No Changeset found

Latest commit: 1451fdd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 11, 2026

Open in StackBlitz

@module-federation/devtools

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

@module-federation/cli

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

create-module-federation

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

@module-federation/data-prefetch

pnpm add https://pkg.pr.new/@module-federation/data-prefetch@b9272e2

@module-federation/dts-plugin

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

@module-federation/enhanced

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

@module-federation/error-codes

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

@module-federation/esbuild

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

@module-federation/managers

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

@module-federation/manifest

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

@module-federation/metro

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

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

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

@module-federation/metro-plugin-rnef

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

@module-federation/modern-js

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

@module-federation/modern-js-v3

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

@module-federation/native-federation-tests

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

@module-federation/native-federation-typescript

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

@module-federation/nextjs-mf

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

@module-federation/node

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

@module-federation/retry-plugin

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

@module-federation/rsbuild-plugin

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

@module-federation/rspack

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

@module-federation/rspress-plugin

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

@module-federation/runtime

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

@module-federation/runtime-core

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

@module-federation/runtime-tools

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

@module-federation/sdk

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

@module-federation/storybook-addon

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

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

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

@module-federation/treeshake-frontend

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

@module-federation/treeshake-server

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

@module-federation/typescript

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

@module-federation/utilities

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

@module-federation/webpack-bundler-runtime

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

@module-federation/bridge-react

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

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

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

@module-federation/bridge-shared

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

@module-federation/bridge-vue3

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

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

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

commit: b9272e2

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 11, 2026

Bundle Size Report

19 package(s) changed, 22 unchanged.

Package dist + public ESM exports

Package Total dist (raw) Delta Public ESM gzip Delta
@changesets/assemble-release-plan 50.4 kB +24.2 kB (+92.7%) 6.6 kB no change
@module-federation/cli 26.7 kB -765 B (-2.7%) 786 B no change
@module-federation/core 39.1 kB no change 173 B no change
@module-federation/data-prefetch 118.3 kB +132 B (+0.1%) 476 B no change
@module-federation/enhanced 841.5 kB +1.2 kB (+0.1%) 1.8 kB no change
@module-federation/managers 70.0 kB no change 334 B no change
@module-federation/manifest 138.4 kB no change 182 B no change
@module-federation/metro 243.9 kB no change 1.6 kB no change
@module-federation/metro-plugin-rnc-cli 0 B no change 314 B no change
@module-federation/modern-js 183.6 kB -98 B (-0.1%) 11.8 kB -10 B (-0.1%)
@module-federation/modern-js-v3 175.2 kB -98 B (-0.1%) 11.3 kB -10 B (-0.1%)
@module-federation/node 188.4 kB no change 4.6 kB no change
@module-federation/rsbuild-plugin 120.4 kB +482 B (+0.4%) 449 B no change
@module-federation/rspack 60.7 kB +2.1 kB (+3.6%) 426 B no change
@module-federation/runtime 19.5 kB +2.9 kB (+17.3%) 1.3 kB +177 B (+16.0%)
@module-federation/runtime-tools 7.8 kB +2.9 kB (+59.6%) 698 B +275 B (+65.0%)
@module-federation/storybook-addon 76.5 kB no change 1.1 kB no change
@module-federation/utilities 110.6 kB no change 328 B no change
@module-federation/webpack-bundler-runtime 90.9 kB +2.4 kB (+2.7%) 696 B +151 B (+27.7%)

Bundle targets

Package Web bundle (gzip) Delta Node bundle (gzip) Delta
@changesets/assemble-release-plan 3.1 kB no change 3.1 kB no change
@module-federation/cli 2.3 kB -144 B (-5.8%) 2.3 kB -144 B (-5.8%)
@module-federation/core 1.1 kB -32 B (-2.9%) 1.0 kB -31 B (-2.9%)
@module-federation/data-prefetch 3.3 kB no change 3.3 kB no change
@module-federation/enhanced 6.3 kB -60 B (-0.9%) 6.3 kB -60 B (-0.9%)
@module-federation/managers 2.4 kB -28 B (-1.1%) 2.4 kB -28 B (-1.1%)
@module-federation/manifest 6.2 kB -40 B (-0.6%) 6.2 kB -40 B (-0.6%)
@module-federation/metro 11.4 kB -55 B (-0.5%) 11.4 kB -54 B (-0.5%)
@module-federation/metro-plugin-rnc-cli 411 B -26 B (-5.9%) 411 B -26 B (-5.9%)
@module-federation/modern-js 7.0 kB -36 B (-0.5%) 7.0 kB -36 B (-0.5%)
@module-federation/modern-js-v3 6.8 kB -34 B (-0.5%) 6.8 kB -34 B (-0.5%)
@module-federation/node 13.2 kB -30 B (-0.2%) 13.1 kB -41 B (-0.3%)
@module-federation/rsbuild-plugin 5.0 kB +14 B (+0.3%) 5.0 kB +14 B (+0.3%)
@module-federation/rspack 3.0 kB +92 B (+3.1%) 3.0 kB +92 B (+3.1%)
@module-federation/runtime 958 B +26 B (+2.8%) 958 B +26 B (+2.8%)
@module-federation/runtime-tools 395 B +21 B (+5.6%) 395 B +21 B (+5.6%)
@module-federation/storybook-addon 2.4 kB -25 B (-1.0%) 2.2 kB -24 B (-1.0%)
@module-federation/utilities 2.6 kB -32 B (-1.2%) 2.6 kB -32 B (-1.2%)
@module-federation/webpack-bundler-runtime 4.0 kB +18 B (+0.4%) 4.0 kB +18 B (+0.4%)

Total dist (raw): 10.69 MB (+35.4 kB (+0.3%))
Total ESM gzip: 118.3 kB (+583 B (+0.5%))
Total web bundle (gzip): 195.1 kB (-371 B (-0.2%))
Total node bundle (gzip): 196.6 kB (-379 B (-0.2%))

Bundle sizes are generated with rslib (Rspack). Public ESM gzip aggregates explicit package export entry files (wildcard exports are ignored). Web/node bundles synthesize a single entry that imports those public ESM exports, set ENV_TARGET, and enable tree-shaking. Bare imports are externalized to keep sizes consistent with prior reporting, and assets are emitted as resources.

@2heal1
Copy link
Copy Markdown
Member

2heal1 commented Mar 12, 2026

esm: '@module-federation/runtime-tools/dist/index.js',
cjs: '@module-federation/runtime-tools/dist/index.cjs',
},
undefined,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see the function will use implementation , but why not pass this parameter ?

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.

Addressed in 28511a8a7.

resolveRuntimePaths() now prefers the provided implementation when resolving runtimeToolsPath, and only falls back to the workspace @module-federation/runtime-tools package if that custom implementation does not publish the newer entrypoint yet. I also added a unit test covering the custom-implementation path and the fallback path.

@ScriptedAlchemy ScriptedAlchemy merged commit d3b8500 into main Mar 12, 2026
37 of 38 checks passed
@ScriptedAlchemy ScriptedAlchemy deleted the codex/runtime-bundler-entrypoints branch March 12, 2026 03:58
@2heal1 2heal1 mentioned this pull request Mar 14, 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