Skip to content

feat(webpack): add StartupChunkDependenciesRuntimeModule to fix chunk splitting#658

Merged
gaoachao merged 9 commits intomainfrom
feat/add-startup-chunk-deps-runtime
May 6, 2025
Merged

feat(webpack): add StartupChunkDependenciesRuntimeModule to fix chunk splitting#658
gaoachao merged 9 commits intomainfrom
feat/add-startup-chunk-deps-runtime

Conversation

@gaoachao
Copy link
Collaborator

@gaoachao gaoachao commented Apr 29, 2025

Summary

add StartupChunkDependenciesRuntimeModule to fix chunk splitting

  • Implement StartupChunkDependenciesRuntimeModule for handling chunk dependencies
  • Fix RuntimeGlobals.ensureChunkHandler not found when using chunk splitting

Related Links:

Checklist

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

@gaoachao gaoachao requested a review from colinaaa as a code owner April 29, 2025 09:53
@changeset-bot
Copy link

changeset-bot bot commented Apr 29, 2025

🦋 Changeset detected

Latest commit: ef9672d

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/chunk-loading-webpack-plugin Patch
@lynx-js/rspeedy Patch
create-rspeedy Patch
upgrade-rspeedy 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

@gaoachao gaoachao changed the title feat(webpack): add StartupChunkDependenciesRuntimeModule to fix chunk… feat(webpack): add StartupChunkDependenciesRuntimeModule to fix chunk splitting Apr 29, 2025
@codecov
Copy link

codecov bot commented Apr 29, 2025

Codecov Report

Attention: Patch coverage is 76.57658% with 26 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...lugin/src/StartupChunkDependenciesRuntimeModule.ts 59.67% 25 Missing ⚠️
...bpack-plugin/src/StartupChunkDependenciesPlugin.ts 97.72% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link

codspeed-hq bot commented Apr 29, 2025

CodSpeed Performance Report

Merging #658 will create unknown performance changes

Comparing feat/add-startup-chunk-deps-runtime (ef9672d) with main (d0603d3)

Summary

🆕 1 new benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 transform 1000 view elements N/A 370.8 ms N/A

Copy link
Collaborator

@colinaaa colinaaa left a comment

Choose a reason for hiding this comment

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

We need to add tests for this. For example, some tests will fail without the StartupChunkDependenciesPlugin.

gaoachao and others added 4 commits April 30, 2025 13:55
Co-authored-by: Qingyu Wang <40660121+colinaaa@users.noreply.github.com>
Signed-off-by: BitterGourd <91231822+gaoachao@users.noreply.github.com>
@gaoachao gaoachao requested a review from colinaaa April 30, 2025 06:55
@gaoachao gaoachao force-pushed the feat/add-startup-chunk-deps-runtime branch from ee9360b to d48250c Compare May 6, 2025 07:12
@gaoachao gaoachao added this pull request to the merge queue May 6, 2025
Merged via the queue into main with commit 2c77005 May 6, 2025
28 of 29 checks passed
@gaoachao gaoachao deleted the feat/add-startup-chunk-deps-runtime branch May 6, 2025 08:26
colinaaa added a commit that referenced this pull request May 6, 2025
…ix chunk splitting" (#705)

Reverts #658

This results in a 2% increase in the bundle size of the hello-world
project.

It seems that the check `if
(chunkGraph.hasChunkEntryDependentChunks(chunk))` in webpack is absent.


https://github.com/webpack/webpack/blob/0f42dc5b8bbfbc71f5550fe1c2e9b2edf38b4c25/lib/runtime/StartupChunkDependenciesPlugin.js#L59
@gaoachao gaoachao restored the feat/add-startup-chunk-deps-runtime branch May 7, 2025 06:20
@colinaaa colinaaa deleted the feat/add-startup-chunk-deps-runtime branch May 9, 2025 02:14
github-merge-queue bot pushed a commit that referenced this pull request May 19, 2025
…le to fix chunk splitting" (#798)

<!--
  Thank you for submitting a pull request!

We appreciate the time and effort you have invested in making these
changes. Please ensure that you provide enough information to allow
others to review your pull request.

Upon submission, your pull request will be automatically assigned with
reviewers.

If you want to learn more about contributing to this project, please
visit:
https://github.com/lynx-family/lynx-stack/blob/main/CONTRIBUTING.md.
-->

## Summary

<!-- Can you explain the reasoning behind implementing this change? What
problem or issue does this pull request resolve? -->

<!-- It would be helpful if you could provide any relevant context, such
as GitHub issues or related discussions. -->

Rspack now has exposed `hasChunkEntryDependentChunks` on ChunkGraph.

Related links:
- #658
- #705
- https://github.com/web-infra-dev/rspack/releases/tag/v1.3.10
- web-infra-dev/rspack#10286

## Checklist

<!--- Check and mark with an "x" -->

- [x] Tests updated (or not required).
- [x] Documentation updated (or not required).

---------

Signed-off-by: BitterGourd <91231822+gaoachao@users.noreply.github.com>
Co-authored-by: Qingyu Wang <40660121+colinaaa@users.noreply.github.com>
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.

2 participants