uglifier icon indicating copy to clipboard operation
uglifier copied to clipboard

Uglifier has random behaviour in variable names

Open aguspina opened this issue 8 years ago • 3 comments

I'm a developer from mumuki rails app, which is deployed here.

When I precompile assets i'm getting different digests for my js file on one of my production servers.

This two links references my two js files from 2 differents machines:

They are nearly identical, except by the fact they have different uglified variable names. This also produces different fingerprints and different file names.

This is one of the differences

 function h(e){var t=Oe.split("|"),n=e.createDocumentFragment();

 function h(e){var t=Pe.split("|"),n=e.createDocumentFragment();

I'm using this gems versions:

  • Ruby: 2.3.1
  • Rails: 4.1.14
  • sprockets: 3.6.0
  • execjs: 2.7.0
  • uglifier: 2.7.2

This may be related to https://github.com/rails/sprockets/issues/74

aguspina avatar Dec 01 '16 15:12 aguspina

Are the files identical/have same fingerprints if you skip Uglifier on deploy? To my understanding UglifyJS should be deterministic, and that also applies to Uglifier.

When I re-ran the (compressed) files through Uglifier 3.0.4, there was difference when referencing other asset files: at least /assets/ace/mode-gobstones-45d6d875ebd3644727117887e01787315da440e45958bb7d76d646d11f88c870.js had different fingerprint in the two files.

lautis avatar Dec 01 '16 19:12 lautis

Hey your are right, but this is code from both mode-gobstones js files:

var e=c.replace("\\d","\\d\\-")
var e=u.replace("\\d","\\d\\-")

that's why both files have differents digests.

aguspina avatar Dec 02 '16 14:12 aguspina

We are seeing this as well.

< var s = [];
< return b(this.text(t), n.term, s, i), s.join("");
---
> var o = [];
> return _(this.text(t), n.term, o, i), o.join("");

It causes problems typically with fingerprinting.

montdidier avatar Aug 22 '18 03:08 montdidier