Skip to content

Fix compressibility of modules while retaining portability#20287

Merged
alexander-akait merged 5 commits intowebpack:mainfrom
dmichon-msft:stable-module-sort
Jan 12, 2026
Merged

Fix compressibility of modules while retaining portability#20287
alexander-akait merged 5 commits intowebpack:mainfrom
dmichon-msft:stable-module-sort

Conversation

@dmichon-msft
Copy link
Contributor

Summary
Addresses an issue raised by @sokra in #19184 with respect to sorting by final module id impairing compressibility of output code.

What kind of change does this PR introduce?

Fix for compressibility of output code while retaining portability of sort order.

Did you add tests for your changes?

Updated the existing test for default module sort order.

Does this PR introduce a breaking change?

Not unless code has taken a dependency on the rendered order of modules within a chunk, which nothing should be doing without itself controlling the rendered order.

If relevant, what needs to be documented once your changes are merged or what have you already documented?

For most customers, this will look equivalent to reverting #19184. The only time differences will appear is when comparing output across environments (Windows vs. Linux, different installation folders on Windows, etc.) for the same input code.

@changeset-bot
Copy link

changeset-bot bot commented Jan 6, 2026

🦋 Changeset detected

Latest commit: 3ad4fa6

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

This PR includes changesets to release 1 package
Name Type
webpack 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

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 6, 2026

Merging this PR will not alter performance

✅ 72 untouched benchmarks


Comparing dmichon-msft:stable-module-sort (3ad4fa6) with main (d2a124d)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (081104f) during the generation of this report, so d2a124d was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Comment on lines 17349 to 17360
exports[`ConfigCacheTestCases css large exported tests should allow to create css modules: dev 1`] = `
Object {
"placeholder": "my-app-tailwind_module_css-placeholder-gray-700",
}
`;

exports[`ConfigCacheTestCases css large exported tests should allow to create css modules: prod 1`] = `
Object {
"placeholder": "Xk90he",
}
`;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unexpected deletion

@hai-x
Copy link
Member

hai-x commented Jan 9, 2026

Hi, do you need any help?

@dmichon-msft
Copy link
Contributor Author

@hai-x , mostly just got sidetracked, and was having some issues getting my environments to properly update the snapshot tests (they were exiting with OoM due to the low spec on the agent). I think this should be correct now? If there are still other issues, then yes, I might need some assistance getting this over.

@hai-x
Copy link
Member

hai-x commented Jan 10, 2026

Fixed the lint problem.

@alexander-akait alexander-akait merged commit 03440e2 into webpack:main Jan 12, 2026
50 of 51 checks passed
@github-actions
Copy link
Contributor

This PR is packaged and the instant preview is available (03440e2).

Install it locally:

  • npm
npm i -D webpack@https://pkg.pr.new/webpack@03440e2
  • yarn
yarn add -D webpack@https://pkg.pr.new/webpack@03440e2
  • pnpm
pnpm add -D webpack@https://pkg.pr.new/webpack@03440e2

@dmichon-msft dmichon-msft deleted the stable-module-sort branch January 12, 2026 21:59
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.

3 participants