publint icon indicating copy to clipboard operation
publint copied to clipboard

Suggest `"sideEffects": false`

Open lishaduck opened this issue 8 months ago • 1 comments

This helps bundlers optimize code better. I'd say that 98% of packages should be able to add this, but I'm not sure when we can detect the 2% of cases when it's wrong to add it.

lishaduck avatar Apr 20 '25 21:04 lishaduck

Sounds good to me 👍 I don't think there's particularly cases where it's wrong to add, but probably just unnecessary, e.g. if the package was never intended or not cared to be bundled, then the field probably isn't helpful.

As a start, maybe we can check a few things, e.g. if there's a "browser" field, "module" field, "browser" condition, or "module" condition, then we'd suggest this if those field exist which we assume it'll be consumed by bundlers.

bluwy avatar Apr 21 '25 01:04 bluwy