Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bf3de9b

Browse filesBrowse files
arturovtmhevery
authored andcommitted
perf(common): use ngDevMode to tree-shake warnings (#39964)
This commit adds ngDevMode guard to show warnings only in dev mode (similar to how things work in other parts of Ivy runtime code). The ngDevMode flag helps to tree-shake these warnings from production builds (in dev mode everything will work as it works right now) to decrease production bundle size. PR Close #39964
1 parent 2fbb684 commit bf3de9b
Copy full SHA for bf3de9b

File tree

2 files changed

+3
-3
lines changed
Filter options

2 files changed

+3
-3
lines changed

‎packages/common/src/directives/ng_for_of.ts

Copy file name to clipboardExpand all lines: packages/common/src/directives/ng_for_of.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Directive, DoCheck, EmbeddedViewRef, Input, isDevMode, IterableChangeRecord, IterableChanges, IterableDiffer, IterableDiffers, NgIterable, TemplateRef, TrackByFunction, ViewContainerRef} from '@angular/core';
9+
import {Directive, DoCheck, EmbeddedViewRef, Input, IterableChangeRecord, IterableChanges, IterableDiffer, IterableDiffers, NgIterable, TemplateRef, TrackByFunction, ViewContainerRef} from '@angular/core';
1010

1111
/**
1212
* @publicApi
@@ -159,7 +159,7 @@ export class NgForOf<T, U extends NgIterable<T> = NgIterable<T>> implements DoCh
159159
*/
160160
@Input()
161161
set ngForTrackBy(fn: TrackByFunction<T>) {
162-
if (isDevMode() && fn != null && typeof fn !== 'function') {
162+
if ((typeof ngDevMode === 'undefined' || ngDevMode) && fn != null && typeof fn !== 'function') {
163163
// TODO(vicb): use a log service once there is a public one available
164164
if (<any>console && <any>console.warn) {
165165
console.warn(

‎packages/common/src/pipes/number_pipe.ts

Copy file name to clipboardExpand all lines: packages/common/src/pipes/number_pipe.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ export class CurrencyPipe implements PipeTransform {
241241
locale = locale || this._locale;
242242

243243
if (typeof display === 'boolean') {
244-
if (<any>console && <any>console.warn) {
244+
if ((typeof ngDevMode === 'undefined' || ngDevMode) && <any>console && <any>console.warn) {
245245
console.warn(
246246
`Warning: the currency pipe has been changed in Angular v5. The symbolDisplay option (third parameter) is now a string instead of a boolean. The accepted values are "code", "symbol" or "symbol-narrow".`);
247247
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.