-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "sideEffects": false to Orbit packages #969
Comments
@DanielGiljam thanks for the suggestion! I believe all of Orbit's packages are indeed side-effect-free. Would you like to PR this change? |
@dgeb Yes, gladly! I agree that Orbit's packages are side-effect-free in the sense that we can add "sideEffects": false, even though there's technically at least one place (potentially several places) where I can think of side-effects occurring. In I don't think side-effects of this kind make the library any less tree-shakeable, so I don't think it should prevent us from adding "sideEffects": false. However, making the library 100% side-effect-free could be done fairly easily. One would just have to go through the code and change all the places where it can't be statically analyzed as side-effect-free. But it would require a larger PR and it may not serve any real purpose. So perhaps adding "sideEffects": false is enough? |
@DanielGiljam after a bit of review, I agree that it's probably fine to mark all the public packages as free of side-effects. The
I don't think we could take this approach because modifications to the Orbit global singleton are the means by which an app (or lib that depends on Orbit) can override functions such as I'm going to merge #972 and will get a new release out shortly. Please let me know if you see any unexpected behavior with tree-shaking. Thanks again for your work on this. |
Adding "sideEffects": false to each Orbit packages’ package.json would allow build tools to tree shake the packages when bundling code for e.g. a web app.
The text was updated successfully, but these errors were encountered: