alphagov / government-frontend

Serves government pages on GOV.UK
https://docs.publishing.service.gov.uk/apps/government-frontend.html
MIT License
50 stars 17 forks source link

Use Terser instead of Uglifier #3167

Closed MartinJJones closed 2 months ago

MartinJJones commented 3 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 government-frontend/application.js 122KB 22.7KB
terser government-frontend/application.js 122KB 22.8KB

Browser testing

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