Skip to content

fix(modernjs): quiet valid stream SSR splitChunks config#4851

Open
BleedingDev wants to merge 5 commits into
module-federation:mainfrom
BleedingDev:codex/fix-modernjs-splitchunks-warning
Open

fix(modernjs): quiet valid stream SSR splitChunks config#4851
BleedingDev wants to merge 5 commits into
module-federation:mainfrom
BleedingDev:codex/fix-modernjs-splitchunks-warning

Conversation

@BleedingDev

Copy link
Copy Markdown
Contributor

Summary

  • keep stream SSR splitChunks normalization to async
  • skip the warning when splitChunks.chunks is already async
  • cover both Modern.js adapters with unit tests

Validation

  • pnpm --filter @module-federation/modern-js-v3 run test
  • pnpm --filter @module-federation/modern-js run test
  • pnpm exec prettier --check packages/modernjs-v3/src/cli/configPlugin.ts packages/modernjs-v3/src/cli/configPlugin.spec.ts packages/modernjs/src/cli/configPlugin.ts packages/modernjs/src/cli/configPlugin.spec.ts .changeset/quiet-stream-ssr-splitchunks.md
  • pnpm exec turbo run build --filter=@module-federation/modern-js... --filter=@module-federation/modern-js-v3... --concurrency=4

@changeset-bot

changeset-bot Bot commented Jun 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0b08935

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 47 packages
Name Type
@module-federation/modern-js Patch
@module-federation/modern-js-v3 Patch
shared-tree-shaking-with-server-host Patch
shared-tree-shaking-with-server-provider Patch
@module-federation/runtime Patch
@module-federation/enhanced Patch
@module-federation/rspack Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/sdk Patch
@module-federation/runtime-tools Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/dts-plugin Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/devtools Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
@module-federation/bridge-shared Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/retry-plugin Patch
@module-federation/rsbuild-plugin Patch
@module-federation/error-codes Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/runtime-core Patch
create-module-federation Patch
@module-federation/cli Patch
@module-federation/rspress-plugin Patch
@module-federation/treeshake-server Patch
@module-federation/treeshake-frontend Patch
@module-federation/metro Patch
@module-federation/metro-plugin-rnef Patch
@module-federation/metro-plugin-rock Patch
@module-federation/metro-plugin-rnc-cli Patch
@module-federation/esbuild Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/observability-plugin Patch
@module-federation/playground Patch
website-new Patch
@module-federation/storybook-addon Patch
shared-tree-shaking-no-server-host Patch
shared-tree-shaking-no-server-provider Patch
@module-federation/utilities Patch
remote5 Patch
remote6 Patch
node-dynamic-remote-new-version Patch
node-dynamic-remote Patch

Not sure what this means? Click here to learn what changesets are.

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

@netlify

netlify Bot commented Jun 27, 2026

Copy link
Copy Markdown

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 0b08935
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/6a3fb625e459750008265ab0
😎 Deploy Preview https://deploy-preview-4851--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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cfbb0f58ab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/bridge/bridge-react/src/router/v8-dom.tsx Outdated
Comment thread packages/bridge/bridge-react/src/router/v8.tsx Outdated
@BleedingDev BleedingDev force-pushed the codex/fix-modernjs-splitchunks-warning branch from cfbb0f5 to d7001da Compare June 27, 2026 09:10
@BleedingDev BleedingDev force-pushed the codex/fix-modernjs-splitchunks-warning branch from d7001da to 4ae9519 Compare June 27, 2026 09:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ae9519251

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +342 to +344
const currentChunks = splitChunkConfig.chunks;
splitChunkConfig.chunks = 'async';
logger.warn(
`splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"`,
);
if (currentChunks !== 'async') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Warn for cacheGroup chunk overrides

When a user's config has top-level splitChunks.chunks: 'async' but any cache group sets its own chunks: 'all'/'initial', this guard suppresses the stream-SSR warning even though cache-group chunks overrides the top-level setting. This code only rewrites splitChunkConfig.chunks and leaves those cache-group overrides untouched, so the incompatible split remains silently (same mirror in modernjs-v3). Please include cache-group chunk overrides in the check or normalize them before skipping the warning.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 948dc693d4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

`splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"`,
);

for (const cacheGroup of Object.values(splitChunkConfig.cacheGroups)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include fallback cache groups in SSR normalization

When stream SSR uses top-level splitChunks.chunks: 'async' but splitChunks.fallbackCacheGroup.chunks is set to 'all' or 'initial', this new pass only scans cacheGroups, so shouldWarn can stay false while the fallback cache group still overrides chunk selection. Webpack documents fallbackCacheGroup.chunks as part of split-chunk chunk selection (https://webpack.js.org/plugins/split-chunks-plugin/#splitchunkschunks), so this can silently leave the same incompatible initial/all split in place; the mirrored loop in packages/modernjs-v3/src/cli/configPlugin.ts needs the same handling.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d9e7b963c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

splitChunkConfig.cacheGroups
typeof splitChunkConfig === 'object'
) {
let shouldWarn = splitChunkConfig.chunks !== 'async';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Treat omitted splitChunks.chunks as async

When a stream-SSR client build leaves optimization.splitChunks.chunks unset, the bundler default is already async, but this initializer treats the resulting undefined as a change-worthy value and emits the warning anyway. That makes otherwise valid default splitChunks configs noisy again; the mirrored logic in packages/modernjs-v3/src/cli/configPlugin.ts needs the same default-as-async handling.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 299cb93fef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +354 to +357
'chunks' in cacheGroup &&
cacheGroup.chunks !== 'async'
) {
cacheGroup.chunks = 'async';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve function-valued cache group filters

When an SSR client config uses a function-valued cacheGroups.foo.chunks that already limits the group to async chunks, this condition treats the function as incompatible and replaces it with 'async'. That broadens the cache group to every async chunk and drops the user's chunk-splitting logic; elsewhere in the repo (ContainerPlugin.patchChunkSplit) function filters are explicitly supported. Please wrap or preserve function filters instead of overwriting them, and make the same adjustment in the modernjs-v3 mirror.

Useful? React with 👍 / 👎.

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