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

test(split_chunks): Migrate test/configCases/split-chunks-common of Webpack #3018

Merged
merged 2 commits into from
May 6, 2023

Conversation

hyf0
Copy link
Collaborator

@hyf0 hyf0 commented May 5, 2023

Related issue (if exists)

This PR is blocked by

Closes #2918.

Summary

🤖 Generated by Copilot at 4b99efb

This pull request adds several test cases for the splitChunks optimization feature of rspack, a custom webpack wrapper. The test cases cover different scenarios such as hot module replacement, library output, node target, and chunk order. The test cases consist of source modules, webpack configuration files, and test configuration files that specify the expected output bundles.

Walkthrough

🤖 Generated by Copilot at 4b99efb

  • Add two test cases for split-chunks optimization with HMR for the web target (link-link)
  • Create a common module and a shared module for testing shared chunks (link, link)
  • Create two entry points (first and second) that require the common module and test the main flag for HMR (link, link)
  • Create a vendor module that exports the module.hot object for testing HMR (link)
  • Create an index module that requires the vendor module and tests the main flag for HMR and the require.main property (link)
  • Create webpack configuration files that use the splitChunks optimization to create vendor chunks and enable HMR for the web target (link, link)
  • Create test configuration files that specify the expected output bundles for each test case (link, link)
  • Add a test case for split-chunks optimization with external modules and library target (link-link)
    • Create a module that reads the vendor and main output files and exports their contents as strings (link)
    • Create an index module that conditionally requires some external modules and uses require.ensure to create an async chunk (link)
    • Create a webpack configuration file that uses the splitChunks optimization to create a vendor chunk that contains the vendor entry point, sets the output library target to umd, and sets the externals to some modules and node built-ins (link)
    • Create a test configuration file that specifies the expected output bundles and the external modules for the test case (link)
  • Add two test cases for split-chunks optimization with node target and commonjs2 library target (link-link)
    • Create an index module that requires some modules (a, b, c, d) and tests their exports and the require.main property (link)
    • Create two webpack configuration files that use the splitChunks optimization to create multiple chunks based on different criteria, set the target to node and the output library target to commonjs2 (link)
    • Create a test configuration file that specifies the expected output bundles for each test case (link)
  • Add a test case for split-chunks optimization with correct order of execution (link-link)
    • Create a module that exports a string "a" for testing purposes (link)
    • Create an index module that requires the a module and tests its export and the require.main property (link)
    • Create a test configuration file that specifies the expected output bundle for the test case (link)

@hyf0 hyf0 requested review from h-a-n-a and ahabhgk May 5, 2023 07:43
@hyf0 hyf0 requested a review from hardfist as a code owner May 5, 2023 07:43
@changeset-bot
Copy link

changeset-bot bot commented May 5, 2023

⚠️ No Changeset found

Latest commit: a962762

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

@hyf0 hyf0 changed the title test(split_chunks): Migrate test/configCases/split-chunks-common of Webpack test(split_chunks): Migrate test/configCases/split-chunks-common of Webpack May 5, 2023
@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label May 5, 2023
@hyf0 hyf0 force-pushed the hyf_23809489203849082 branch 2 times, most recently from 15a3528 to a5c010d Compare May 5, 2023 11:04
@hyf0 hyf0 enabled auto-merge May 5, 2023 12:14
@hyf0 hyf0 disabled auto-merge May 6, 2023 04:16
@hyf0 hyf0 enabled auto-merge May 6, 2023 09:13
@hyf0 hyf0 added this pull request to the merge queue May 6, 2023
Merged via the queue into main with commit fc69d2b May 6, 2023
9 checks passed
@hyf0 hyf0 deleted the hyf_23809489203849082 branch May 6, 2023 09:15
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.

Migrate splitChunks test of Webpack at test/configCases/split-chunks-common
4 participants