Skip to content

[Bug]: NO_SIDE_EFFECTS annotation does not work for namespace import calls across chunk boundaries #9956

Description

@fubhy

Reproduction link or steps

@__NO_SIDE_EFFECTS__ works for namespace imports when Rolldown can inline/collapse the namespace in a single chunk, but fails when the same namespace-member call crosses a chunk boundary.

What is expected?

@__NO_SIDE_EFFECTS__ should apply consistently to calls of the annotated exported binding, even when the call is made through a namespace import and the imported module is emitted as a shared chunk.

What is actually happening?

In split/shared output, the calls remain.

https://repl.rolldown.rs/#eNqlU9tugkAQ/ZUJL6uGQnp5omli4iXpS/ugjyQEYdBtcNYsi7Ux/HsHUC5VmyZ94LLnzM6eOTN7tBLLO1papWmsPsmJFCVy7ZisRMnyrjG2FTEhtzulDRwhxkQSTioaCki02oI4bxM++YSHKpQDwzytvs2GwdEnAEm73HhQ/QMIJKO/7kLhgXDc04IPFnaPX3X51SUfdfmo4Qt+F0OfrMK2sk2oMe5U2wJ1ke4IxkHw9h4sXqezYDafzybLRRDAyG2qSnKKjFQECU0xSgf7MM1xWNfCnmUqRSdV64GoechkjIBJgpERNtTRz2WwRpNrqhEGio5zZR4+iWaHnYYXuK2qVfObjirNn3Xww26g5RmdI5vWNuTsWgfpzcYIwgzmSp1mwnFP9n5kgpP6VJcVckUc5Jz8uy9V1MyqYUrFg4eSKdvWtryvoEL+r+DxpoKnvoJyqPoKKuTH/aiz2uf2nW/IhRbXheUGMwRGAVO5lRQajLsir1vUt4fV7fn4tTTjbSgZ+AbM20eC

System Info

System:
    OS: macOS 26.5.1
    CPU: (12) arm64 Apple M2 Max
    Memory: 156.33 MB / 32.00 GB
    Shell: 4.6.0 - /etc/profiles/per-user/fubhy/bin/fish
  Binaries:
    Node: 24.15.0 - /nix/store/3mvbmkd7lmxi3xlka1avra24flwbgjv9-nodejs-24.15.0/bin/node
    npm: 11.12.1 - /nix/store/3mvbmkd7lmxi3xlka1avra24flwbgjv9-nodejs-24.15.0/bin/npm
    pnpm: 11.4.0 - /nix/store/l3awryym5fh66w3ilk9f1gcxkq06fi2r-corepack-0.35.0/bin/pnpm
    bun: 1.3.13 - /nix/store/jgl1hjr0cf6s32jcnqmkp44av4flamap-bun-1.3.13/bin/bun
    Deno: 2.8.3 - /nix/store/a9avpz7i9y2yjhmdimq719ih6wbb4s0p-deno-2.8.3/bin/deno
  npmPackages:
    rolldown: workspace:* => 1.1.2

Any additional comments?

cross_module_optimization.rs only checks identifier callees for SideEffectsFreeFunction, so calls that remain as namespace-member imports across chunks are missed.

Metadata

Metadata

Labels

No labels
No labels

Type

Fields

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions