Skip to content

fix(webpack/react): deduplicate lazy bundles for same file imported via different paths#2138

Draft
orionmiz wants to merge 1 commit intolynx-family:mainfrom
orionmiz:fix-duplicate-lazy-bundle
Draft

fix(webpack/react): deduplicate lazy bundles for same file imported via different paths#2138
orionmiz wants to merge 1 commit intolynx-family:mainfrom
orionmiz:fix-duplicate-lazy-bundle

Conversation

@orionmiz
Copy link

@orionmiz orionmiz commented Jan 26, 2026

(WIP)

When the same file is imported via different relative paths (e.g., ./Foo.jsx
from index.jsx and ../Foo.jsx from subdir/importer.jsx), they now produce
a single bundle instead of duplicates.

The fix extends the asyncChunkName hook to receive ChunkGroup information,
allowing the ReactWebpackPlugin to normalize chunk names based on resolved
module paths rather than raw import strings.

Closes: #455

@coderabbitai summary

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@changeset-bot
Copy link

changeset-bot bot commented Jan 26, 2026

🦋 Changeset detected

Latest commit: b5ab2f6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@lynx-js/template-webpack-plugin Patch
@lynx-js/react-webpack-plugin Patch
@lynx-js/react-rsbuild-plugin Patch
@lynx-js/react-alias-rsbuild-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 26, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cla-assistant
Copy link

cla-assistant bot commented Jan 26, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@orionmiz orionmiz changed the title fix(react-webpack-plugin): deduplicate lazy bundles for same file imported via different paths fix(webpack/react): deduplicate lazy bundles for same file imported via different paths Jan 26, 2026
@orionmiz orionmiz force-pushed the fix-duplicate-lazy-bundle branch from b1823d7 to 264c21c Compare January 26, 2026 05:58
…orted via different paths

When the same file is imported via different relative paths (e.g., `./Foo.jsx`
from index.jsx and `../Foo.jsx` from subdir/importer.jsx), they now produce
a single bundle instead of duplicates.

The fix extends the `asyncChunkName` hook to receive ChunkGroup information,
allowing the ReactWebpackPlugin to normalize chunk names based on resolved
module paths rather than raw import strings.

Closes: lynx-family#455

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@orionmiz orionmiz force-pushed the fix-duplicate-lazy-bundle branch from 264c21c to b5ab2f6 Compare January 26, 2026 07:24
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.

[Bug]: same lazy bundle used multiple times with different rel path import should output single bundle

1 participant