diff --git a/packages/abc/date-picker/range.directive.ts b/packages/abc/date-picker/range.directive.ts
index c82c3e1e3a..f1458ddbd4 100644
--- a/packages/abc/date-picker/range.directive.ts
+++ b/packages/abc/date-picker/range.directive.ts
@@ -72,10 +72,12 @@ export class RangePickerDirective implements OnDestroy, AfterViewInit {
@Host() @Optional() private nativeComp: NzRangePickerComponent,
private vcr: ViewContainerRef
) {
- assert(
- !!nativeComp,
- `It should be attached to nz-range-picker component, for example: ''`
- );
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
+ assert(
+ !!nativeComp,
+ `It should be attached to nz-range-picker component, for example: ''`
+ );
+ }
const cog = configSrv.merge('dataRange', {
nzFormat: 'yyyy-MM-dd',
nzAllowClear: true,
diff --git a/packages/util/other/assert.ts b/packages/util/other/assert.ts
index 781f16e27d..47ca403381 100644
--- a/packages/util/other/assert.ts
+++ b/packages/util/other/assert.ts
@@ -5,7 +5,7 @@ declare const ngDevMode: boolean;
function throwError(msg: string | null | undefined): void;
function throwError(msg: string | null | undefined, actual: unknown, expected: unknown, comparison: string): void;
function throwError(msg: string | null | undefined, actual?: unknown, expected?: unknown, comparison?: string): void {
- if (ngDevMode) {
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
throw new Error(
`ASSERTION ERROR: ${msg}${comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`}`
);