Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): add console error when using HMR …
Browse files Browse the repository at this point in the history
…in production mode

FIx: #19591
  • Loading branch information
alan-agius4 authored and filipesilva committed Dec 15, 2020
1 parent f73a878 commit ba9c755
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

// tslint:disable-next-line: no-implicit-dependencies
import { ApplicationRef, PlatformRef, Type, ɵresetCompiledComponents } from '@angular/core';
import { ApplicationRef, PlatformRef, Type, isDevMode, ɵresetCompiledComponents } from '@angular/core';
import { filter, take } from 'rxjs/operators';

// For the time being we cannot use the DOM lib because it conflicts with @types/node,
Expand All @@ -27,6 +27,12 @@ export default function (mod: any): void {
return;
}

if (!isDevMode()) {
console.error(`[NG HMR] Cannot use HMR when Angular is running in production mode. To prevent production mode, do not call 'enableProdMode()'.`);

return;
}

mod['hot'].accept();
mod['hot'].dispose(() => {
if (typeof ng === 'undefined') {
Expand Down

0 comments on commit ba9c755

Please sign in to comment.