Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(new_split_chunks): should not care about reuseExistingChunk if name is specified for CacheGroup #3045

Merged
merged 1 commit into from
May 8, 2023

Conversation

hyf0
Copy link
Collaborator

@hyf0 hyf0 commented May 6, 2023

Related issue (if exists)

Summary

Blocks #3043

Align with https://github.com/webpack/webpack/blob/46cdedb4ba67aa75ccb00919e6cc8594d7445146/lib/optimize/SplitChunksPlugin.js#L1333-L1341

🤖 Generated by Copilot at a0edb96

This pull request updates and adds some test cases for the split chunks plugin in webpack, which is implemented in the rspack_plugin_split_chunks_new crate. It also simplifies the logic of finding or creating chunks for module groups in the plugin. The main goal is to improve the test coverage and the correctness of the plugin.

Walkthrough

🤖 Generated by Copilot at a0edb96

  • Simplify the logic of finding or creating a chunk for a module group in the split chunks plugin (link)
  • Update the import path of the webpack configuration type in the test cases to use the dist folder instead of the root folder (link, link, link)
  • Remove the name property from the foo cache group in the test cases to avoid confusion with the chunk name comment in the dynamic import of the foo module (link, link)
  • Add a webpack chunk name comment to the dynamic import of the foo module in the test cases to ensure that it creates a separate chunk (link, link, link)
  • Update the assertions in the test cases to expect the correct chunks based on the module group name, priority, and reuseExistingChunk option (link, link, link)
  • Add a new test case should-not-reuse-existing-chunk-simple-if-cache-group-name-specified with a new webpack configuration file webpack.config.js, a new entry module index.js, and two new modules foo.js and foo-2.js that belong to a cache group named splittedFoo (link, link, link, link)

@hyf0 hyf0 requested a review from ahabhgk May 6, 2023 15:37
@hyf0 hyf0 requested a review from hardfist as a code owner May 6, 2023 15:37
@changeset-bot
Copy link

changeset-bot bot commented May 6, 2023

⚠️ No Changeset found

Latest commit: 9d4af89

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions bot added release: bug fix team The issue/pr is created by the member of Rspack. labels May 6, 2023
@hyf0

This comment was marked as outdated.

@hyf0 hyf0 force-pushed the hyf_u23q8849028349082390 branch from a0edb96 to 137ccfb Compare May 7, 2023 12:57
@hyf0 hyf0 enabled auto-merge May 7, 2023 12:57
@hyf0 hyf0 force-pushed the hyf_u23q8849028349082390 branch from 137ccfb to 9d4af89 Compare May 8, 2023 06:34
@hyf0 hyf0 added this to the 0.1.10 - Patch milestone May 8, 2023
@hyf0 hyf0 added this pull request to the merge queue May 8, 2023
Merged via the queue into main with commit f27bb0d May 8, 2023
11 checks passed
@hyf0 hyf0 deleted the hyf_u23q8849028349082390 branch May 8, 2023 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants