Skip to content

feat: add ineffective dynamic import warning#7600

Closed
luke358 wants to merge 4 commits intorolldown:mainfrom
luke358:feat/ineffective-dynamic-import-warning
Closed

feat: add ineffective dynamic import warning#7600
luke358 wants to merge 4 commits intorolldown:mainfrom
luke358:feat/ineffective-dynamic-import-warning

Conversation

@luke358
Copy link
Contributor

@luke358 luke358 commented Dec 19, 2025

This PR implements the changes described in #7541

  • Implement warning for dynamic imports that won't create separate chunks when a module is both statically and dynamically imported.
  • Detect modules with both static and dynamic importers in same chunk and filter out HMR hot.accept to avoid false positives
  • Add some cases covering various scenarios

Copy link
Member

Choose a reason for hiding this comment

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

This test case is redundant, as there already exists a similar test case in our codebase.

Copy link
Member

Choose a reason for hiding this comment

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

I think there also exists a similar testcase for this one as well.

@IWANABETHATGUY
Copy link
Member

Could you review your test cases again and remove those that are redundant or already covered by existing tests in our codebase?

return;
}

for chunk in chunk_graph.chunk_table.iter() {
Copy link
Member

Choose a reason for hiding this comment

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

I assume this has a perf impact because we are adding a new loop here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed that there are duplicated loops at

These loops look very similar and might be merged. Since the chunks have already been processed at this point, it seems reasonable to collect warnings here.

@luke358
Copy link
Contributor Author

luke358 commented Dec 20, 2025

Could you review your test cases again and remove those that are redundant or already covered by existing tests in our codebase?

Thanks for the feedback!
I’m reviewing the test cases now and will remove the redundant ones shortly.

graphite-app bot pushed a commit that referenced this pull request Feb 12, 2026
closes #7541, #7600, #7971

---

Thanks to @luke358 for the effort in PR #7600.
Thanks to @AliceLanniste for the effort in PR #7971.

Co-authored-by: luke358 <qq1494135711@gmail.com>
Co-authored-by: AliceLanniste <1399789151@qq.com>
@shulaoda
Copy link
Member

Closed by #8284

@shulaoda shulaoda closed this Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants