Skip to content

Commit

Permalink
Merge pull request #3137 from alphagov/minify-uglifyjs-config
Browse files Browse the repository at this point in the history
Enable UglifyJS compatibility workarounds
  • Loading branch information
colinrotherham authored Jan 16, 2023
2 parents 6280b88 + 04a6669 commit c5fc0e3
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tasks/compile-javascripts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,24 @@ export async function compileJavaScript ([modulePath, { srcPath, destPath, minif
*/
export function minifyJavaScript (modulePath, result) {
const minified = minify({ [modulePath]: result.code }, {
ie8: true,
sourceMap: {
content: result.map,
filename: result.map.file,
url: `${result.map.file}.map`,
includeSources: true
}
},

// Prevent unsafe polyfill changes
// https://github.com/mishoo/UglifyJS#compress-options
compress: {
inline: 2
},

// Compatibility workarounds
ie8: true,
module: false,
v8: true,
webkit: true
})

if (minified.error) {
Expand Down

0 comments on commit c5fc0e3

Please sign in to comment.