Skip to content

Rolldown creates a different CJS bundle in ~50% runs #7646

@trivikr

Description

@trivikr

Describe the bug

Rolldown creates a different CJS bundle on some runs when using AWS SDK for JavaScript

Steps to reproduce

Follow instructions in https://github.com/trivikr/test-rolldown-aws-sdk-js-v3-bundle/tree/b3c43980ee3305cba689f361ec664029435f0ab1
At the time of comment, it's tested with [email protected] and @aws-sdk/[email protected]

Observed behavior

A different bundle is created on some runs, leading to git diff

$ ./test-build.sh
...

---------------

Iteration 2

> build
> rolldown -c

<DIR>/bundle.js  chunk │ size: 381.24 kB

✔ rolldown v1.0.0-beta.57 Finished in 93.30 ms
No changes in bundle.js

---------------

Iteration 3

> build
> rolldown -c

<DIR>/bundle.js  chunk │ size: 381.23 kB

✔ rolldown v1.0.0-beta.57 Finished in 92.95 ms
Git diff detected in bundle.js - failing at iteration 3

Expected behavior

The loop should run forever, and bundle created shouldn't change.

Additional context

We noticed this issue when testing @aws-sdk/find-v2, where we search for AWS SDK for JavaScript (v2) bundled in applications using different popular bundlers.

Over 90+ runs of the all bundler configurations, we noticed that the artifact difference only appears when we attempt to create CJS bundle using rolldown, and it happens around 30-40% of the times. The artifact doesn't differ for ESM bundle created with rolldown, or CJS/ESM bundle created with other bundlers. We tested webpack, rollup, esbuild, parcel and rspack.

Metadata

Metadata

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