Skip to content

feat: add module-mixed-chunks rule#1509

Merged
yifancong merged 4 commits intomainfrom
feat/rule-mixed-chunk-type-module
Jan 30, 2026
Merged

feat: add module-mixed-chunks rule#1509
yifancong merged 4 commits intomainfrom
feat/rule-mixed-chunk-type-module

Conversation

@yifancong
Copy link
Copy Markdown
Contributor

Summary

image

Related Links

Copilot AI review requested due to automatic review settings January 23, 2026 11:57
Copy link
Copy Markdown
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 a new linting rule module-mixed-chunks (E1006) to detect when a module is included in both initial and async chunks, which can lead to code duplication and increased bundle size.

Changes:

  • Added ModuleMixedChunksRuleStoreData type definition and E1006 error code with documentation
  • Implemented the module-mixed-chunks rule that checks for modules appearing in both initial and async chunks
  • Created UI component ModuleMixedChunksAlertCollapse to display violations in the Rsdoctor report

Reviewed changes

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

Show a summary per file
File Description
packages/types/src/rule/data.ts Adds ModuleMixedChunksRuleStoreData interface for storing rule violation data
packages/types/src/rule/code/E1006.ts Defines error code E1006 with description and solutions for the mixed chunks issue
packages/types/src/rule/code/index.ts Registers E1006 error code in the rule error map
packages/types/src/plugin/internal-rules.ts Adds 'E1006' and 'module-mixed-chunks' to internal rule type definitions
packages/core/src/rules/rules/module-mixed-chunks/types.ts Defines configuration interface with ignore pattern support
packages/core/src/rules/rules/module-mixed-chunks/index.ts Implements the rule logic to detect modules in both initial and async chunks
packages/core/src/rules/rules/index.ts Exports and registers the new rule in the rules array
packages/components/src/components/Alerts/collapse-module-mixed-chunks.tsx Creates UI component to display mixed chunks violations with initial and async chunk details
packages/components/src/components/Alerts/bundle-alert.tsx Integrates E1006 tab and component into the bundle alerts UI
examples/rsbuild-minimal/src/utils/shared.ts Adds example file (incomplete - missing exports)
examples/rsbuild-minimal/src/components/AsyncComponent.tsx Adds example component (not used, has broken imports)
examples/rsbuild-minimal/src/App.tsx Adds dynamic import to demonstrate mixed chunks scenario
examples/rsbuild-minimal/rsbuild.config.ts Configures example to trigger the module-mixed-chunks rule

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

Comment thread examples/rsbuild-minimal/src/utils/shared.ts
Comment thread examples/rsbuild-minimal/rsbuild.config.ts
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Jan 26, 2026

Deploying rsdoctor with  Cloudflare Pages  Cloudflare Pages

Latest commit: d6a2df3
Status: ✅  Deploy successful!
Preview URL: https://10da0bed.rsdoctor.pages.dev
Branch Preview URL: https://feat-rule-mixed-chunk-type-m.rsdoctor.pages.dev

View logs

@yifancong yifancong force-pushed the feat/rule-mixed-chunk-type-module branch from f658993 to 988cb6c Compare January 29, 2026 10:58
@yifancong yifancong requested a review from fansenze January 29, 2026 11:02
@yifancong yifancong requested a review from fi3ework January 30, 2026 03:13
@yifancong yifancong merged commit 437606b into main Jan 30, 2026
4 checks passed
@yifancong yifancong deleted the feat/rule-mixed-chunk-type-module branch January 30, 2026 05:01
@yifancong yifancong mentioned this pull request Feb 5, 2026
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.

3 participants