We're using requirejs.optimize(config)
with uglify2 in our build scripts to minify our production JavaScript code. We want to limit the minified line length to about 80 chars, so that it will be easier to debug JavaScript errors even from the production code. (Most browsers only report the line number, not the column, in the onerror handler, so source maps do not help.)
Uglify2 contains the max-line-len option in the beautifier options. I've tried many different combinations of the following options, but haven't been able to get the code minified, but with limited line length:
config = {
optimize: 'uglify2',
uglify2: {
output: {
beautify: true
},
beautify: {
beautify: false,
max_line_len: 80
}
},
// ...
}
How can I pass the option to limit the line length to uglify2?