Skip to content

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

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

tonoizer wants to merge 169 commits 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.

tonoizer and others added 30 commits June 12, 2026 10:51
Co-authored-by: Hanric <hanric.zhang@gmail.com>
…ation#4790)

Co-authored-by: ScriptedAlchemy <zack@module-federation.io>
)

Co-authored-by: ScriptedAlchemy <zack@module-federation.io>
…che-busting (module-federation#4661)

Co-authored-by: ScriptedAlchemy <zack@module-federation.io>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…n getDependentFiles (module-federation#4804)

Co-authored-by: Hanric <hanric.zhang@gmail.com>
… backoff (module-federation#4828)

Co-authored-by: Shashank Upadhyay <shashank.upadhyay@sprinklr.com>
Co-authored-by: ScriptedAlchemy <zack@module-federation.io>
…ation#4861)

Co-authored-by: ScriptedAlchemy <zack@module-federation.io>
…federation#4853)

Co-authored-by: Shashank Upadhyay <shashank.upadhyay@sprinklr.com>
Co-authored-by: ScriptedAlchemy <zack@module-federation.io>
…le-federation#4863)

Co-authored-by: ScriptedAlchemy <zack@module-federation.io>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Moves the repo's @rspack/core, @rspack/cli and @rspack/dev-server to 2.x (core and cli 2.1.10, dev-server 2.2.1). The @module-federation/rspack peer range already accepts ^2.0.0-0. Demo apps drop experiments.css for a css/auto rule and turn off lazy compilation for remotes served by rspack serve.
ScriptedAlchemy and others added 24 commits September 25, 2026 21:46
…() (module-federation#5148)

esbuild reports metafile output paths relative to absWorkingDir. The plugin resolved them, and the manifest's shared package.json lookups, from process.cwd(), so a build with a different absWorkingDir failed with ENOENT on dist/remoteEntry.js or wrote its manifest next to the process. Builds that do not set absWorkingDir are unchanged.
…tion#5115)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
… timeout (module-federation#5085)

Co-authored-by: ScriptedAlchemy <zackary.l.jackson@gmail.com>
…ation#5176)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…e-federation#5173)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…n#5174)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ScriptedAlchemy <zackaryjackson@bytedance.com>
…5188)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#5175)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ScriptedAlchemy <zackaryjackson@bytedance.com>
…r/next-app-router-4001 (module-federation#5189)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ScriptedAlchemy <zackaryjackson@bytedance.com>
@tonoizer
tonoizer force-pushed the docs/experiments-optimization-target branch from aa21c04 to bde36d2 Compare November 8, 2026 21:48

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.