Legacy Angular App - Source Map Analysis

NOTE: This advice relates to the legacy Angular frontend, which we are deprecating and is included for reference purposes until that work is complete.

As the Supervision Frontend logic runs in the browser, all libraries needed by the application are bundled into a single JavaScript file.

Running source-map-explorer lets you see the libraries and Angular modules that make up these JS files.

This can be useful for identifying unused libraries that are still being bundled, or identifying overly large libraries that are bloating these files

Any reduction in the size of these libraries should be a slight improvement for the end user, as it will download quicker on an initial load and potentially run faster in low resource situations

Running Source Map Explorer

Source map explorer can be run either through make

make supervision-generate-source-map-analysis

This will generate a html file that displays the makup of the js files

Source Map Explorer output

Example

In the above moment JS is bundling all locales, despite the application only needing the one for Great Britain

Removing this, would reduce the bundle by roughly 300k, which is more than 10 percent of the total size

Moment JS bundling