Skip to content

[bug] Non-deterministic ordering of modules in bundle output when using deterministic module IDs on different platforms #19141

@D4N14L

Description

@D4N14L

Bug report

What is the current behavior?

Currently, some dependencies are bundled differently depending on the platform that the bundle operation is being performed on. In the attached minimal repro, the jszip package is bundled on both Linux and Windows machines. The bundle output contains the exact same content, except for one specific module is being included in the bundle at a different point depending on the platform. Interestingly, the module IDs remain the same (as would be expected with deterministic module IDs), it's just the order of entry in the output bundle.

Example diff:

Image

Note that changing the ordering of the module entries ensures that there is no diff between the two produced bundles.

If the current behavior is a bug, please provide the steps to reproduce.

jszip-bundle-repro.zip

Using the included repro:

  • npm i
  • npm run build and observe the outputs on Linux
  • Perform same operation on Windows
  • Compare the two generated files

For convenience, I've included the bundle output in the repro zip for both Linux and Windows.

What is the expected behavior?

Module ordering in bundle output should be deterministic on both platforms when using deterministic module IDs

Other relevant information:
webpack version: 5.95.0
Node.js version: 18.19.1
Operating System: Linux/Windows
Additional tools: jszip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions