Add 'sideEffects: false' to pure modules #18
Replies: 2 comments 1 reply
-
It's something I have been wanting to add, yes, but I have been hoping and waiting for an official property for this, and ideally one that assumes no side effects by default. The reality is that very few packages have side effects, so it would be easier to annotate those than to annotate the ones that don't have side effects. It's also a huge amount of work, so it needs to be automated. Someone would need to write a script that adds it to package.json in each of my repos and open a pull request. I think only a handful of my packages have side effects, so the script should be able to open a pull requests to all of them and I can just close the pull request for the few where it should not be added. |
Beta Was this translation helpful? Give feedback.
-
Sounds good, I'll make sure the file PRs to add the property on suitable repos. |
Beta Was this translation helpful? Give feedback.
-
Have you considered adding
sideEffects: false
to ESM packages that are pure in the sense that their functions do not have side effects? This property is supported by many bundlers and enables tree-shaking when used in combination with ESM.Bundling is not only relevant to the web. I recently started to bundle node CLIs as well via esbuild, which enables instant installation times of these CLIs as well as startup performance gains because node only has to read a single file. I'm also contemplating bundling regular non-CLI modules.
Beta Was this translation helpful? Give feedback.
All reactions