Skip to content

[Bug]: moduleSideEffects Behavior May Vary Due to Non-Deterministic Parse Order #4738

@sxzz

Description

@sxzz

Reproduction link or steps

https://bundler.sxzz.dev/#eNrtUT1vwyAQ/SsnFhLJ8g9A8tihc8emg2WOiAofFh+tJYv/XqjtuEk9ZMoUBuDd4x539yammJiYJoljHXy5ExMbrlhXYD9YF4C35LXnJ8phZCK4iKlizhoj7TfVnSWlz/XnRWWHmfVw/NWTqNpoAkwnAhhMPGvyAt4LgjlYFrU9CuA4BnTUGl6thENvzRe+yoOWFcw1ojtumQBaQSahaZq1+Ct6ebBk1po6EyX6A++tzN3z483r8meIjmCC8uVakoAyigpyVjT4piW+KIVdyM2o1niE9FckAZbY/cI36Ru4XNMyk/n8yHumWPZm7mP1Y0F7nv5zNA77fl7Fn24+0M2UfgBXKxww

  • Switch to Rolldown
  • Click anchor icon of mod.ts for enable/disable entry file, repeatly
Screen.Recording.2025-05-30.at.00.12.14.mov

What is expected?

A consistent behavior:

  • In Rollup, the ansis import is always not tree-shaken.
  • In my opinion, it should be tree-shaken if moduleSideEffects is set to false and not set to true (undefined) anywhere.

What is actually happening?

The ansis import is sometimes removed (tree-shaken) unpredictably.

System Info

N/A

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions