Skip to content

Conversation

ScriptedAlchemy
Copy link
Contributor

Summary

  • Fix compilation errors in rspack_plugin_mf crate that prevented building
  • Add public API for accessing ConsumeSharedModule options to resolve private field access violations
  • Fix type mismatches between Ustr and Identifier types in module graph operations

- Add public get_options() method to ConsumeSharedModule for accessing private options field
- Fix type mismatches between Ustr and Identifier in module graph operations
- Add proper mutability declarations for module graph mutations
- Collapse nested if statements to follow clippy style guidelines
- Implement finishModules hook to copy build metadata from fallback modules
@Copilot Copilot AI review requested due to automatic review settings September 9, 2025 12:42
Copy link

netlify bot commented Sep 9, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit a01c551
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/68c3e9780104ee0008fbf5b1

@github-actions github-actions bot added the release: bug fix release: bug related release(mr only) label Sep 9, 2025
Copy link
Contributor

@Copilot 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 fixes compilation errors in the rspack_plugin_mf crate by resolving type mismatches and private field access issues in the consume shared plugin functionality.

  • Adds a new hook for processing ConsumeSharedModule instances during compilation to copy metadata from fallback modules
  • Introduces a public API method to access ConsumeSharedModule options that were previously private
  • Updates imports to include necessary types for module graph operations

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
crates/rspack_plugin_mf/src/sharing/consume_shared_plugin.rs Adds finish_modules hook implementation and updates imports to support module graph operations
crates/rspack_plugin_mf/src/sharing/consume_shared_module.rs Adds public getter method for accessing ConsumeOptions

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

// Only process ConsumeSharedModule instances with fallback dependencies
if let Some(consume_shared) = module.as_any().downcast_ref::<ConsumeSharedModule>() {
// Check if this module has a fallback import
if consume_shared.get_options().import.is_some() {
Copy link
Preview

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

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

The condition checks for import.is_some() but the logic processes modules regardless of whether they have fallback dependencies. Consider adding validation to ensure the module actually has fallback dependencies before adding it to the processing list.

Copilot uses AI. Check for mistakes.

Comment on lines 422 to 424
for module_id in consume_shared_modules {
let fallback_module_id = {
let module_graph = compilation.get_module_graph();
Copy link
Preview

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

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

The module graph is accessed multiple times within the loop (lines 424, 475, 487). Consider restructuring to minimize repeated access to the module graph for better performance.

Suggested change
for module_id in consume_shared_modules {
let fallback_module_id = {
let module_graph = compilation.get_module_graph();
let module_graph = compilation.get_module_graph();
for module_id in consume_shared_modules {
let fallback_module_id = {

Copilot uses AI. Check for mistakes.

Copy link
Contributor

github-actions bot commented Sep 9, 2025

📦 Binary Size-limit

Comparing a01c551 to refactor: use temporary data to replace unsupported Module (#11652) by jinrui

❌ Size increased by 7.75KB from 47.45MB to 47.45MB (⬆️0.02%)

- Add test configuration for nested consume shared module scenarios
- Include package dependencies and ESM/CJS module test setup
Copy link

codspeed-hq bot commented Sep 9, 2025

CodSpeed Performance Report

Merging #11621 will not alter performance

Comparing fix/consume-shared-plugin-compilation-errors (a01c551) with main (bbe54ce)

Summary

✅ 17 untouched

ScriptedAlchemy and others added 4 commits September 10, 2025 14:35
…raph access; clippy cleanups

- Process only modules with fallback import
- Compute fallback meta with single graph borrow
- Emit warning when fallback not found instead of defaulting
- Collapse nested ifs, use Option::map per clippy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: bug fix release: bug related release(mr only)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant