Skip to content

fix(enhanced): add esm export for runtime entry to fix vite resolution#4682

Merged
2heal1 merged 2 commits intomodule-federation:mainfrom
2heal1:fix/issue-4680
Apr 27, 2026
Merged

fix(enhanced): add esm export for runtime entry to fix vite resolution#4682
2heal1 merged 2 commits intomodule-federation:mainfrom
2heal1:fix/issue-4680

Conversation

@2heal1
Copy link
Copy Markdown
Member

@2heal1 2heal1 commented Apr 22, 2026

This change adds an ESM export for the runtime entry in @module-federation/enhanced to resolve Vite compatibility issues where it couldn't properly resolve the module.

  • Modified packages/enhanced/package.json to include .mjs import for the runtime entry.
  • Updated packages/enhanced/tsdown.config.mts to build the ESM runtime entry with .mjs extension.

Fixes #4680

Change-Id: If3915f016731bb1a3612ec4e4c9c2cc2cd84ecca

Description

Related Issue

#4680

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.

module-federation#4680)

This change adds an ESM export for the runtime entry in @module-federation/enhanced to resolve Vite compatibility issues where it couldn't properly resolve the module.

- Modified `packages/enhanced/package.json` to include `.mjs` import for the runtime entry.
- Updated `packages/enhanced/tsdown.config.mts` to build the ESM runtime entry with `.mjs` extension.

Fixes module-federation#4680

Co-Authored-By: Aime <aime@bytedance.com>
Change-Id: If3915f016731bb1a3612ec4e4c9c2cc2cd84ecca
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 22, 2026

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 9e649a4
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/69eaeefb77c0440008cd3d6e
😎 Deploy Preview https://deploy-preview-4682--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 Apr 22, 2026

⚠️ No Changeset found

Latest commit: 9e649a4

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 Apr 22, 2026

Open in StackBlitz

@module-federation/devtools

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

@module-federation/cli

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

create-module-federation

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

@module-federation/data-prefetch

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

@module-federation/dts-plugin

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

@module-federation/enhanced

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

@module-federation/error-codes

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

@module-federation/esbuild

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

@module-federation/managers

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

@module-federation/manifest

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

@module-federation/metro

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

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

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

@module-federation/metro-plugin-rnef

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

@module-federation/modern-js

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

@module-federation/modern-js-v3

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

@module-federation/native-federation-tests

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

@module-federation/native-federation-typescript

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

@module-federation/nextjs-mf

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

@module-federation/node

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

@module-federation/retry-plugin

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

@module-federation/rsbuild-plugin

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

@module-federation/rspack

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

@module-federation/rspress-plugin

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

@module-federation/runtime

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

@module-federation/runtime-core

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

@module-federation/runtime-tools

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

@module-federation/sdk

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

@module-federation/storybook-addon

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

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

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

@module-federation/treeshake-frontend

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

@module-federation/treeshake-server

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

@module-federation/typescript

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

@module-federation/utilities

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

@module-federation/webpack-bundler-runtime

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

@module-federation/bridge-react

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

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

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

@module-federation/bridge-shared

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

@module-federation/bridge-vue3

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

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

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

commit: 9e649a4

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

Bundle Size Report

10 package(s) changed, 30 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 487.9 kB +6.6 kB (+1.4%) 3.9 kB no change
@module-federation/enhanced 814.1 kB +70 B (+0.0%) 672 B no change
@module-federation/managers 69.8 kB no change 334 B no change
@module-federation/manifest 138.0 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/storybook-addon 77.6 kB no change 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 -31 B (-1.3%) 2.3 kB -31 B (-1.3%)
@module-federation/core 1.1 kB -30 B (-2.7%) 1.0 kB -29 B (-2.7%)
@module-federation/devtools 21.3 kB -27 B (-0.1%) 21.3 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.2 kB -36 B (-0.6%) 6.2 kB -36 B (-0.6%)
@module-federation/metro-plugin-rnc-cli 411 B -24 B (-5.5%) 411 B -24 B (-5.5%)
@module-federation/node 9.2 kB -27 B (-0.3%) 9.2 kB -27 B (-0.3%)
@module-federation/storybook-addon 1.9 kB -22 B (-1.1%) 1.7 kB -22 B (-1.2%)
@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 19.8 kB -20 B (-0.1%) 20.8 kB -15 B (-0.1%) +1.0 kB +5 B

Total dist (raw): 6.33 MB (+6.6 kB (+0.1%))
Total ESM gzip: 74.0 kB (no change)
Total web bundle (gzip): 179.5 kB (-297 B (-0.2%))
Total node bundle (gzip): 180.0 kB (-296 B (-0.2%))
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.

@2heal1 2heal1 merged commit 74348db into module-federation:main Apr 27, 2026
23 checks passed
@2heal1 2heal1 mentioned this pull request Apr 29, 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.

Runtime - The application fails to load, and the browser console throws the following error

1 participant