Fix problem when minifying with Uglify2#110
Fix problem when minifying with Uglify2#110pjeweb wants to merge 2 commits intojs-cookie:masterfrom pjeweb:master
Conversation
Code did not work because `[1, undefined, 2].join('')` gets minified to `1 + undefined + 2` in Uglify2 with compress.evaluate option set to true.
Also make code better understandable :)
copy paste failed here ;)
|
I will take a look on it later, but it seems to be a problem with Uglify2. |
|
Yes it's UglifyJS's problem but still this code relies on a not easily understandable feature of JS. |
That's a trade-off that was made in order to maintain the "~800 bytes gzipped" bullet point documented in the "Features" section of the README. Right now we have 874 bytes gzipped as from #71. I understand the legibility argument and I agree with that. The point is that we have currently 100% test coverage and use TDD extensively, so it is unlikely that a bug arises from now on because of those legibility problems. Feel free to throw a |
|
There is apparently a pull request for that issue in Uglify from 2013 (mishoo/UglifyJS#301). Hope it gets fixed there. When I have the time I will look into |
|
In the mean time you can use the minified version from the Releases page or build your own minified file using: |
|
Well we have a running build process (using gulp, babel, browserify) and integrating another build process into that is not really worth it. |
|
Btw thanks for responding fast and this project 👍 |
|
You're welcome. Good hacking 👍 |
Code did not work because basically
[1, undefined, 2].join('')gets minified to1 + undefined + 2in Uglify2 with compress.evaluate option set to true.Also make code better understandable :)
Tested with https://skalman.github.io/UglifyJS-online/: