I had already stopped supporting IE8, but UglifyJS was still writing JavaScript around its quirks. The screw-ie8 flag tells the minifier to stop preserving that compatibility behavior.
Without this flag, UglifyJS preserves behavior IE8 expects—like how try/catch affects variable scope or how named function expressions work. Those workarounds can add bytes to a bundle even when the browser is no longer in your support matrix.
From the command line:
cat input.js | uglifyjs --screw-ie8 -o output.js
Setting it up in Gulp
Here’s the full Gulp task:
var minifier = require('gulp-uglify/minifier')
var uglifyjs = require('uglify-js')
var rename = require('gulp-rename')
gulp.task('uglify', function () {
return gulp.src(['js/*.js'])
.pipe(minifier({
compress: {
screw_ie8: true
},
mangle: {
screw_ie8: true
}
}, uglifyjs))
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('dist'))
})
I’m using gulp-uglify/minifier instead of the standard gulp-uglify. This lets me pass my own uglify-js version for more control. The screw_ie8 flag needs to be set in both compress and mangle to fully remove IE8 compatibility code. gulp-rename adds .min to the filename so original and minified versions coexist.
With screw_ie8: true, UglifyJS removes workarounds for IE8’s broken try/catch scoping, handles named function expressions normally, produces shorter variable names without IE8 reserved word restrictions, and skips IE8-specific edge cases. The result is a smaller bundle for the browsers this project actually supported.
Microsoft ended support for IE8 in January 2016. Once my own support requirement was gone, keeping its minifier workarounds made no sense.
One quick signal
Did this earn your time?
Thanks. That gives me something concrete to check.


