lautis / uglifier

Ruby wrapper for UglifyJS JavaScript compressor.
http://www.rubydoc.info/gems/uglifier
MIT License
615 stars 81 forks source link

Uglifier 4.1.19 breaks Openlayers #153

Closed fjl82 closed 5 years ago

fjl82 commented 5 years ago

After updating uglifier in my Ruby on Rails 5.2.1 project from 4.1.18 to 4.1.19, Openlayers is no longer generating the correct url's to maptiles. The url for a tile is based on a template, where {x} is replaced by a value, but this value is incorrect.

The correct url is: https://4.base.maps.cit.api.here.com/maptile/2.1/maptile/newest/normal.day/8/141/96/256/png?app_id=&app_code=

And with uglifier 4.1.19 the url becomes: https://4.base.maps.cit.api.here.com/maptile/2.1/maptile/newest/normal.day/8/141.6640625/96/256/png?app_id=&app_code=

Somehow a value that should be an integer gets turned into a float? Reverting back to 4.1.18 fixes the issue. In the deployment log I can see a new asset being generated for openlayers. This is with both 3.18.2 and 5.2.0 (which is the latest version of openlayers at the moment).

I hope this bug report is not too vague, but my javascript skills are not good enough to debug minified code, so I have no idea where to look for more information. It's also really hard to debug because it doesn't happen in development (since the code is not ran through uglifier there).

nylen commented 5 years ago

uglify-js version 3.4.9 is bad, and hasn't been fixed yet. See (for example) https://github.com/mishoo/UglifyJS2/issues/3269#issuecomment-428061406, and lots of other reports on their repo.

pedrofurtado commented 5 years ago

@nylen @fjl82 Look this issue: https://github.com/lautis/uglifier/issues/155