Skip to content

docs(experiments): clarify optimization target defaults - #5109

Open
tonoizer wants to merge 1 commit into
module-federation:mainfrom
tonoizer:docs/experiments-optimization-target
Open

tonoizer wants to merge 1 commit into
module-federation:mainfrom
tonoizer:docs/experiments-optimization-target

Conversation

@tonoizer

Copy link
Copy Markdown
Contributor

Description

Correct the experiments.optimization.target documentation to match the current Webpack and Rspack plugin behavior:

  • The default is unset; ENV_TARGET is not inferred from the bundler's target option.
  • Users should set target: 'web' explicitly for browser builds so Node.js-specific loader code can be removed at compile time.
  • Users should set target: 'node' explicitly for Node.js builds, including SSR scenarios.

Search findings:

  • #4452 describes ENV_TARGET as a compile-time value supplied by the build configuration and preserves a runtime fallback when it is absent.
  • #3704 initially added target inference, but its follow-up commit be54b58 removed inference from both plugins and explicitly documented that ENV_TARGET is only set manually.
  • Merged #4518 continued the explicit ENV_TARGET tree-shaking path and added emitted-output coverage; the existing fixture still asserts that ENV_TARGET is absent unless configured.
  • #4900 adds automatic target selection only in the Modern.js integrations, not in the core Webpack/Rspack plugins.

Because the core plugin behavior and tests intentionally reject inference, this is a documentation-only correction; no code or changeset is included.

Validation: git diff --check passed. The targeted Prettier check was attempted but could not run because this container has Node.js 20.19.2 while the repository's pnpm requires Node.js 22.13+ (the repository CI uses Node.js 24).

Related Issue

Historical context: #4452 (closed). This PR documents the behavior implemented by its follow-up work and does not alter that fix.

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.

@changeset-bot

changeset-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8636d0a

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

This branch has not been deployed

No deployments
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