External JS loading in different order depending on view

I am new to Jira Development and am creating a custom field plugin.
The plugin requires 3 external scripts to be loaded and instantiated in a specific order to function properly.

leaflet-src.js
mapbox-gl.js
leaflet-mapbox-gl.js

In the Issue View these scripts load in the correct order, however in the “Open Issues” view (the project view with the list of issues on the left hand side), the scripts load in a different order which breaks the plugin functionality.

This loads in a separate
mapbox-gl.js
leaflet-src.js
leaflet-mapbox.gl.js

This fails because the mapbox-gl.js creates an uncaught reference error “L is not defined”
The only difference I can see is the initiator for mapbox-gl.js has become batch.js?locale=…

What is the recommended/correct way of forcing these scripts to load in a specific order?
Or what else could be causing this script to load successfully on one view but fail on another?

Thanks in advance.

  • Chris