Issue #3416508 by Niklan, Anybody, odi, catch, Grevil, herve001: Skip...
Issue #3416508 by Niklan, Anybody, odi, catch, Grevil, herve001: Skip generating aggregates that won't be used for stale asset requests
(cherry picked from commit cdfabaf1)
@@ -28,10 +28,12 @@ public function __construct(protected readonly LoggerInterface $logger) {}
*/
publicfunctionoptimize(array$js_asset){
if($js_asset['type']!=='file'){
thrownew\Exception('Only file JavaScript assets can be optimized.');
thrownew\Exception("Error trying to optimize JavaScript asset: {$js_asset['data']}. Only file JavaScript assets can be optimized.");
}
// Note, that files with "preprocess" set to FALSE should never even enter
// this method.
if(!$js_asset['preprocess']){
thrownew\Exception('Only file JavaScript assets with preprocessing enabled can be optimized.');
thrownew\Exception("Error trying to optimize JavaScript asset: {$js_asset['data']}. Only file JavaScript assets with preprocessing enabled can be optimized.");
}
// If a BOM is found, convert the file to UTF-8, then use substr() to