json-2-csv icon indicating copy to clipboard operation
json-2-csv copied to clipboard

Add `sideEffects: false` to package.json

Open neoncube2 opened this issue 7 months ago • 2 comments

Hello! :)

Can sideEffects: false please be added to package.json? This can enable more tree-shaking, in some cases: https://github.com/webpack/webpack/blob/main/examples/side-effects/README.md

Other popular libraries, such as axios, have already added this flag: https://github.com/axios/axios/pull/5025

I'd be happy to open a PR :)

(Also true for deeks and doc-path)

neoncube2 avatar Jul 30 '25 21:07 neoncube2

Hi @neoncube2, Thanks for the suggestion and for reporting this! That's a great idea, and I'd be happy to accept a pull request that adds sideEffects: false to the package.json file. I appreciate you pointing this out and providing the extra context.

I look forward to reviewing your PR!

mrodrig avatar Jul 30 '25 22:07 mrodrig

Hi, @mrodrig,

I gave this a shot, but it turns out that in order for this flag to be useful, the library need to be an ESModule (I guess?). (More documentation about the sideEffects flag)

Have you thought about upgrading this module to an ESModule? I think this would make it so that the package would only run on the latest versions of node.js but would lead to smaller bundle sizes when used on the web. No worries if you don't want to upgrade to ESM, since I suspect that this library is mostly used on node.js, but I figured I'd ask :)

neoncube2 avatar Aug 01 '25 21:08 neoncube2

I went ahead and opened a PR for this. I think this might be helpful even if the library doesn't use ESModules, for the reasons I detailed here: https://github.com/eugenezinovyev/react-fontawesome-svg-icon/issues/36#issuecomment-3663844017 :)

neoncube2 avatar Dec 17 '25 07:12 neoncube2