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
Webpack optimization bailout due to side effects in rambda.mjs #647
Comments
I will check. Thanks for report and the example repo. |
I can see that there is issue with Rambda and your setup. I see that Ramda behaves better. I found that Rambda 5.0.0 is one of the latest versions that works well. I will investigate further. |
I think I found a solution. I will make a release and ask you to test it out. |
Fastest reaction i've ever seen <3 |
I will release a patch release, but I will do that during the weekend. I will write here once it is released. |
There will be some delay as I want to improve tree shaking testing as part of this ticket. Otherwise the solution seems simple, but I want to be sure that it will work to other bundlers as well. |
Sure thing, take your time |
I will use your config as base for webpack check and run it against local build of the library. Then, I will output the size of the bundle. BTW, with your exact configuration, even the simplest library version(one export of simple function as R.add), still triggers warning, so I am unsure how reliable these warnings are. What I see is that the final output size through minification is influenced by declarations in |
Yep, I can see that tree-shaking does not work even if I leave
But with such ^ content I don't get any warnings about And as I add smth like
|
It will be an error to develop around tree-shaking of particular tool, especially in the context of |
Yep, you're right here, I totally agree. If the problem with bailout warnings still has place after this issue resolution (with whatever outcome), I will try other webpack optimization techniques to see if there is a problem with Terser plugin. But if it defines "side-effect" as it is defined in the scientific field, then he is kinda right in his conclusions. |
I think I found the solution. I will keep the issue open until the release is made and you confirm that it is fixed. |
Hello! Sorry for delayed response, github decided not notify me with an email for some reason :/ Yep, tree-shaking fix definitely works. I've commited an updated stats.json to the reproduction repo. It now shows only 1 rambda side-effect, but it does not affect tree-shaking. |
thanks for the feedback @fatawesome it helps to confirm that it works. I still have a work to do to create a process out of this, so I will close the issue as it solves the problem. |
Hi and thanks for the lib!
While replacing lodash with rambda I found that webpack optimizations cannot be performed due to top-level variables.
Basically, webpack treats variable definitions, such as
const adjust = curry(adjustFn)
as a side-effect.The actual error/warning from webpack is
I've also made a reproduction repo - https://github.com/fatawesome/rambda-side-effects-example
What do you think on this issue?
The text was updated successfully, but these errors were encountered: