diff --git a/core/lib/Drupal/Core/Asset/AssetResolver.php b/core/lib/Drupal/Core/Asset/AssetResolver.php index cd1d067d3c..c52ee7ffad 100644 --- a/core/lib/Drupal/Core/Asset/AssetResolver.php +++ b/core/lib/Drupal/Core/Asset/AssetResolver.php @@ -260,7 +260,7 @@ public function getJsAssets(AttachedAssetsInterface $assets, $optimize) { // Preprocess can only be set if caching is enabled and no // attributes are set. - $options['preprocess'] = $options['cache'] ? $options['preprocess'] : FALSE; + $options['preprocess'] = $options['cache'] && empty($options['attributes']) ? $options['preprocess'] : FALSE; // Always add a tiny value to the weight, to conserve the insertion // order.