Is Uglified output "randomized"?

103 views
Skip to first unread message

Robert Gould

unread,
Oct 4, 2012, 9:27:12 AM10/4/12
to ugli...@googlegroups.com
Hi,

I'm currently using UglifyJS ("version" : "1.2.6") downloaded from NPM to uglify a rather large code base, but depending on the machine that I use to uglify the code the uglified output is different.

Is this expected behavior? Does the enviroment, time, or some other factor have an effect on the Uglify parser that would cause this "randomization" of the output?

thanks in advance!

Mihai Călin Bazon

unread,
Oct 4, 2012, 9:36:00 AM10/4/12
to ugli...@googlegroups.com
There should be no "random" into it on purpose. Does the generated
code work fine in both cases?

In any case, you might want to try a newer version.

Cheers,
-Mihai
--
Mihai Bazon,
http://mihai.bazon.net/blog

Robert Gould

unread,
Oct 4, 2012, 10:16:02 AM10/4/12
to ugli...@googlegroups.com
Although the code's order seems to be different each output works 100% the same, so I hadn't really noticed anything until recently

But, I think I tracked it down to the way the OS (Debian) stores the files in a directory
If I go into the same directory on different production machines (where I get diffs) and do ls -U (unsorted list) that's the exact same order in which files get compressed and joined 

The trap here seems to be that I had tested this on my dev machines (Debian6-64) and they all gave the same order with ls -U, but on my production servers (Debian5-64) the ls -U order is different for each machine. So it seems like this is not an issue with Uglify, but my build process not accounting for the difference between OS versions.
Reply all
Reply to author
Forward
0 new messages