Skip to content

Conversation

@ScriptedAlchemy
Copy link
Contributor

  • feat: support async startup promise across formats
  • fix(runtime): avoid duplicate export for mf async startup

Copilot AI review requested due to automatic review settings October 16, 2025 19:48
@netlify
Copy link

netlify bot commented Oct 16, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit c24eeae
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6922a1dd2aa0c2000807fb8f

@github-actions github-actions bot added the release: feature release: feature related release(mr only) label Oct 16, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for async startup promises across different module formats and fixes duplicate exports in module federation async startup scenarios.

  • Adds async startup promise support for multiple module formats
  • Fixes duplicate export issues in module federation async startup runtime
  • Updates test snapshots to reflect webpack runtime changes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

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

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.

ℹ️ 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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2025

📦 Binary Size-limit

Comparing c24eeae to feat: support SRI with experiments.css and CssExtractRspackPlugin (#12239) by harpsealjs

❌ Size increased by 48.00KB from 47.63MB to 47.68MB (⬆️0.10%)

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 16, 2025

CodSpeed Performance Report

Merging #11899 will not alter performance

Comparing feature/async-startup-runtime-promise (4d7a5ff) with main (ca1a20f)

Summary

✅ 17 untouched

ScriptedAlchemy and others added 15 commits October 16, 2025 17:37
…t dependencies

- Add defensive safeguard to remove current chunk ID from chunks_ids
- Ensures direct execution is used when no chunk dependencies exist
- Fixes hundreds of snapshot test failures
- Aligns with enhanced implementation behavior

The issue was that chunks_ids could contain the current chunk ID after
get_all_chunks() traversal, preventing the condition 'chunks_ids.is_empty()'
from being true even for simple entries with no dependencies.

Test results:
- TreeShaking suite: All 82 tests pass
- Total passing: 5466 tests (up from ~5000)
- Remaining 17 failures are unrelated runtime issues with split chunks
- Fix path resolution in 1-container-full test to handle both CJS and ESM execution contexts
- Revert chunk-matcher to main version, removing experimental async startup changes
- Sync WASI binding exports (auto-generated)

These test fixes improve compatibility with dual-bundle execution contexts
and reduce test failures related to the async startup implementation.
Pass `self.async_chunk_loading || async_enabled` to runtime modules instead of
just `async_enabled`. This ensures projects using async chunk loaders (like
`chunkLoading: "async-node"`) continue to work correctly even when MF async
startup is disabled.

Previously, the code only passed `async_enabled` which would be false for
non-MF projects, causing them to get synchronous startup code that would
execute entries before their chunks finished loading.
Allow async startup when mfAsyncStartup is explicitly true, even for chunks with container entries. Only disable async startup for containers when it's implicitly enabled through chunk handlers.
Previously, enhanced mode would only set fallback error functions for
__webpack_require__.f.consumes, __webpack_require__.f.remotes, and
__webpack_require__.I instead of including the actual handler implementations.
This caused runtime errors when async startup was enabled.

Now enhanced mode includes the actual handler code:
- ConsumeSharedRuntimeModule includes consumesCommon.js, consumesInitial.js, and consumesLoading.js
- RemoteRuntimeModule includes remotesLoading.js
- ShareRuntimeModule includes initializeSharing.js

Also adds container entry detection to prevent async startup for container.js
files while allowing it for host files (main.js) that consume remotes.

Test results improved from 14 failures to 5 failures.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
…pping

Refactored the runtime chunk mapping logic to handle multi-runtime scenarios
more robustly. The plugin now builds a comprehensive runtime-to-chunk map
that considers all chunks with runtime, not just entry chunks.

Key changes:
- Build runtime_chunk_map from all chunks with runtime, not just entries
- Improved module hoisting to handle complex runtime scenarios
- Added fallback to hoist to all runtime chunks if no specific runtime found
- Simplified chunk cleanup logic (removed chunk removal for now)

This addresses issues with module hoisting in Module Federation scenarios
where multiple runtime chunks need to share hoisted modules.
…lugin

The runtime chunk detection was broken because it used chunk.runtime()
which returns the runtime SPEC, not whether the chunk IS a runtime chunk.

Use get_chunk_graph_entries() which directly returns actual runtime chunks.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@ScriptedAlchemy ScriptedAlchemy force-pushed the feature/async-startup-runtime-promise branch from 453bcc7 to c573019 Compare November 22, 2025 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: feature release: feature related release(mr only)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants