Skip to content

fix: lazy load DTS plugin modules#4755

Draft
BleedingDev wants to merge 1 commit into
module-federation:mainfrom
BleedingDev:fix/lazy-load-dts-plugins
Draft

fix: lazy load DTS plugin modules#4755
BleedingDev wants to merge 1 commit into
module-federation:mainfrom
BleedingDev:fix/lazy-load-dts-plugins

Conversation

@BleedingDev
Copy link
Copy Markdown
Contributor

Summary

  • Lazy-load @module-federation/dts-plugin from the Rspack plugin only when DTS is enabled.
  • Lazy-load @module-federation/dts-plugin/core from manifest metadata generation only when DTS metadata is needed.
  • Add Jest coverage proving disabled DTS paths do not resolve the DTS packages.

Why

Consumers that disable DTS should not need the DTS plugin packages to be resolved or imported at runtime. A plain nested require() was not enough here because Rslib rewrote it into a top-level ESM import, so this uses createRequire(import.meta.url) to keep both CJS and ESM outputs lazy.

Validation

  • pnpm --filter @module-federation/manifest --filter @module-federation/rspack run lint
  • pnpm exec jest --config packages/manifest/jest.config.js --runInBand
  • pnpm exec jest --config packages/rspack/jest.config.js --runInBand
  • pnpm --filter @module-federation/manifest... --filter @module-federation/rspack... run build

@netlify
Copy link
Copy Markdown

netlify Bot commented May 25, 2026

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 044311a
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/6a147d83e77af500081fc889
😎 Deploy Preview https://deploy-preview-4755--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 25, 2026

⚠️ No Changeset found

Latest commit: 044311a

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

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