Skip to content

Conversation

@JSerFeng
Copy link
Contributor

Summary

fix #12400

Align webpack's behavior of removing empty entry chunk.

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings December 10, 2025 17:27
@netlify
Copy link

netlify bot commented Dec 10, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit bbdf7c0
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/693a46019e38e9000805a13d

@github-actions github-actions bot added team The issue/pr is created by the member of Rspack. release: bug fix release: bug related release(mr only) labels Dec 10, 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 fixes issue #12400 by aligning rspack's behavior with webpack for removing empty entry chunks. The core change removes an overly restrictive condition in the RemoveEmptyChunksPlugin that was preventing the removal of empty chunks that had entry options.

Key changes:

  • Removed the get_entry_options check from empty chunk detection logic in RemoveEmptyChunksPlugin
  • Added comprehensive test case rspack-issue-12400 to verify empty chunks with entry options are properly removed
  • Test validates that empty shared chunks (like app~app2) are no longer created when they contain no modules

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
crates/rspack_plugin_remove_empty_chunks/src/lib.rs Removed get_entry_options condition to allow removal of empty chunks that are entry points, aligning with webpack behavior
tests/rspack-test/configCases/split-chunks/rspack-issue-12400/test.config.js Specifies expected bundle files for test execution
tests/rspack-test/configCases/split-chunks/rspack-issue-12400/rspack.config.js Configures test with split chunks and plugin to track chunk creation
tests/rspack-test/configCases/split-chunks/rspack-issue-12400/src/app.js Main test file verifying empty chunks are removed
tests/rspack-test/configCases/split-chunks/rspack-issue-12400/src/app2.js Second entry point for testing shared chunk behavior
tests/rspack-test/configCases/split-chunks/rspack-issue-12400/src/async-bar.js Test module with dynamic imports
tests/rspack-test/configCases/split-chunks/rspack-issue-12400/src/async-foo.js Simple test module with external dependency
tests/rspack-test/configCases/split-chunks/rspack-issue-12400/src/async-async-bar.js Nested async module for testing deep chunk hierarchies
tests/rspack-test/configCases/split-chunks/rspack-issue-12400/src/async-async-bar-two.js Additional nested async module
tests/rspack-test/configCases/split-chunks/rspack-issue-12400/src/async-async-async-bar.js Deeply nested async module

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 10, 2025

Rsdoctor Bundle Diff Analysis

Found 5 project(s) in monorepo.

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

📌 Baseline Commit: a9e97cadd9 | PR: #12415

Metric Current Baseline Change
📊 Total Size 5.7 MB 5.7 MB 0 B (0.0%)
📄 JavaScript 5.7 MB 5.7 MB 0 B (0.0%)
🎨 CSS 21.0 B 21.0 B 0 B (0.0%)
🌐 HTML 0 B 0 B N/A
📁 Other Assets 0 B 0 B N/A

📦 Download Diff Report: react-10k Bundle Diff

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

📌 Baseline Commit: a9e97cadd9 | PR: #12415

Metric Current Baseline Change
📊 Total Size 823.6 KB 823.6 KB 0 B (0.0%)
📄 JavaScript 823.6 KB 823.6 KB 0 B (0.0%)
🎨 CSS 0 B 0 B N/A
🌐 HTML 0 B 0 B N/A
📁 Other Assets 0 B 0 B N/A

📦 Download Diff Report: react-1k Bundle Diff

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

📌 Baseline Commit: a9e97cadd9 | PR: #12415

Metric Current Baseline Change
📊 Total Size 2.7 MB 2.7 MB 0 B (0.0%)
📄 JavaScript 2.7 MB 2.7 MB 0 B (0.0%)
🎨 CSS 21.0 B 21.0 B 0 B (0.0%)
🌐 HTML 0 B 0 B N/A
📁 Other Assets 0 B 0 B N/A

📦 Download Diff Report: react-5k Bundle Diff

📁 rome

Path: ../build-tools-performance/cases/rome/dist/rsdoctor-data.json

📌 Baseline Commit: a9e97cadd9 | PR: #12415

Metric Current Baseline Change
📊 Total Size 984.3 KB 984.3 KB 0 B (0.0%)
📄 JavaScript 984.3 KB 984.3 KB 0 B (0.0%)
🎨 CSS 0 B 0 B N/A
🌐 HTML 0 B 0 B N/A
📁 Other Assets 0 B 0 B N/A

📦 Download Diff Report: rome Bundle Diff

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

📌 Baseline Commit: a9e97cadd9 | PR: #12415

Metric Current Baseline Change
📊 Total Size 2.1 MB 2.1 MB 0 B (0.0%)
📄 JavaScript 2.0 MB 2.0 MB 0 B (0.0%)
🎨 CSS 83.0 KB 83.0 KB 0 B (0.0%)
🌐 HTML 0 B 0 B N/A
📁 Other Assets 0 B 0 B N/A

📦 Download Diff Report: ui-components Bundle Diff

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Contributor

github-actions bot commented Dec 10, 2025

📦 Binary Size-limit

Comparing bbdf7c0 to refactor: change dependencies_diagnostics_artifact to use atomic_refcell (#12415) by hardfist

🙈 Size remains the same at 48.19MB

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 10, 2025

CodSpeed Performance Report

Merging #12414 will not alter performance

Comparing fix/remove-empty (bbdf7c0) with main (a9e97ca)

Summary

✅ 17 untouched

@JSerFeng JSerFeng merged commit 2623864 into main Dec 11, 2025
52 checks passed
@JSerFeng JSerFeng deleted the fix/remove-empty branch December 11, 2025 05:58
@CPunisher CPunisher mentioned this pull request Dec 17, 2025
2 tasks
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) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Empty split chunks since 1.6.0

3 participants