在 Uglified JS 中重复 "function(){}.call(this)"

Duplicate "function(){}.call(this)" in Uglified JS

我的丑化(使用rails uglifier)javascript这样结束:

/* ... actual code */}.call(this),function(){}.call(this),function(){}.call(this),function(){}.call(this),function(){}.call(this),function(){}.call(this);

或者对于人类:

}.call(this),
function(){}.call(this),
function(){}.call(this),
function(){}.call(this),
function(){}.call(this),
function(){}.call(this);

Uglifier 应该减少最终产品中的字节数。据我所知,我有一些空的咖啡文件(但超过 6 个),这并不是因为 rails 正在处理它们。有人知道为什么会这样吗?

CoffeeScript wraps all files to a function that is invoked immediately. This prevents variable declarations from multiple files from interfering with each other when the files are concatenated (which is what Rails asset pipeline is doing). Sure, those empty functions could be removed in minification process, but UglifyJS isn't currently able to perform such optimisation.

https://github.com/lautis/uglifier/issues/82