Open boopathi opened 7 years ago
Butternut uglify test harness fix for Safari 10 loop bug:
--- a/test/test.js
+++ b/test/test.js
@@ -68,7 +68,12 @@ describe('butternut', function () {
equal(butternut.squash(code, sample.options).code, code, 'failed idempotency check');
}
- const uglified = UglifyJS.minify(sample.input);
+ const uglifyOptions = {
+ mangle: {
+ safari10: true,
+ }
+ };
+ const uglified = UglifyJS.minify(sample.input, uglifyOptions);
if ('code' in uglified) {
if (uglified.code.length < code.length) {
console.warn(`⚠️ uglify-es generated smaller output:\n butternut: ${code}\n uglify-es: ${uglified.code}`);
Related: https://github.com/mishoo/UglifyJS2/commit/fcd90db30d9af157a4a8e36490bcbb861a3a5884
Edit: fixed patch.
Safari throws a syntax error when declaring a top level for-loop iteration variable the same as a fn parameter
minifies to
with
o
reused in for scope.Refs:
The bug is already shipping in Safari and minifiers have to workaround this bug for these versions of Safari. What do you think?