I'm having an issue with adding a data attribute to my preprocessed / aggregated javascript within my theme.
When I have preprocessing disabled, I am able to add a data attribute to individual files within the .libraries.yml file as suggested within the Drupal docs. {attributes: {data-example-attribute: true}}
However once I enable ['js']['preprocess'] = true;
to the settings.php file instead of my theme JS being aggregated into a single file they do not get aggregated at all.
Is there a hook that I'm missing which I could use to just prepend a data attribute onto the preprocessed JS file.
Using Drupal 9
data-
attributes if merged, because it does not account for attribute values: drupal.org/project/drupal/issues/1587536