alphagov / smart-answers

Serves smart answers on GOV.UK
https://docs.publishing.service.gov.uk/apps/smart-answers.html
MIT License
176 stars 120 forks source link

Move from Uglifier to Terser #6769

Closed MartinJJones closed 6 months ago

MartinJJones commented 6 months ago

What

Use Terser instead of Uglifier to compile JavaScript.

Why

This change is preparation for upgrading to V5 of govuk-frontend in the govuk-publishing-components gem.

govuk-frontend v5 now targets browsers that support ES6. This means that the UMD modules used in govuk_publsihing_components from govuk-frontend use features of ES6 and so it means that Uglifier can't be used anymore because it only supports ES5.

Trello card

Further info

JS Size

minifier file minified JS minified JS (gzip)
uglifer smart-answers/application.js 92.4KB 17.4KB
terser smart-answers/application.js 92.6KB 17.4KB

Browser testing

I've tested the changes on Integration using the browsers below, functionality works as expected without any console errors.