|
6 | 6 | * found in the LICENSE file at https://angular.io/license |
7 | 7 | */ |
8 | 8 |
|
9 | | -import {inject, Injectable, OnDestroy, ɵformatRuntimeError as formatRuntimeError, ɵRuntimeError as RuntimeError} from '@angular/core'; |
| 9 | +import {inject, Injectable, OnDestroy, ɵformatRuntimeError as formatRuntimeError} from '@angular/core'; |
10 | 10 |
|
11 | 11 | import {DOCUMENT} from '../../dom_tokens'; |
12 | 12 | import {RuntimeErrorCode} from '../../errors'; |
@@ -74,7 +74,7 @@ export class LCPImageObserver implements OnDestroy { |
74 | 74 | if (!img) return; |
75 | 75 | if (!img.priority && !img.alreadyWarnedPriority) { |
76 | 76 | img.alreadyWarnedPriority = true; |
77 | | - throwMissingPriorityError(imgSrc); |
| 77 | + logMissingPriorityWarning(imgSrc); |
78 | 78 | } |
79 | 79 | if (img.modified && !img.alreadyWarnedModified) { |
80 | 80 | img.alreadyWarnedModified = true; |
@@ -118,14 +118,14 @@ export class LCPImageObserver implements OnDestroy { |
118 | 118 | } |
119 | 119 | } |
120 | 120 |
|
121 | | -function throwMissingPriorityError(ngSrc: string) { |
| 121 | +function logMissingPriorityWarning(ngSrc: string) { |
122 | 122 | const directiveDetails = imgDirectiveDetails(ngSrc); |
123 | | - throw new RuntimeError( |
| 123 | + console.warn(formatRuntimeError( |
124 | 124 | RuntimeErrorCode.LCP_IMG_MISSING_PRIORITY, |
125 | | - `${directiveDetails} this image is the Largest Contentful Paint (LCP) element ` + |
126 | | - `but was not marked "priority". This can have a strong negative impact ` + |
127 | | - `on the LCP score of the entire application. This error can be fixed by ` + |
128 | | - `adding the 'priority' attribute to all images which are possibly the LCP element.`); |
| 125 | + `${directiveDetails} this image is the Largest Contentful Paint (LCP) ` + |
| 126 | + `element but was not marked "priority". This image should be marked ` + |
| 127 | + `"priority" in order to prioritize its loading. ` + |
| 128 | + `To fix this, add the "priority" attribute.`)); |
129 | 129 | } |
130 | 130 |
|
131 | 131 | function logModifiedWarning(ngSrc: string) { |
|
0 commit comments