File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ import { IOptions } from "../declarations";
22import { ControllerDataBase } from "./controller-data-base" ;
33import * as _ from "lodash" ;
44
5+ function isTruthyBooleanValue ( value : unknown ) : boolean {
6+ return value === true || value === "true" ;
7+ }
8+
59export class PrepareData extends ControllerDataBase {
610 public release : boolean ;
711 public hmr : boolean ;
@@ -34,10 +38,9 @@ export class PrepareData extends ControllerDataBase {
3438 }
3539
3640 const hmr =
37- data . hmr ||
38- data . useHotModuleReload ||
39- env . hmr === true ||
40- env . hmr === "true" ;
41+ isTruthyBooleanValue ( data . hmr ) ||
42+ isTruthyBooleanValue ( data . useHotModuleReload ) ||
43+ isTruthyBooleanValue ( env . hmr ) ;
4144
4245 this . release = data . release ;
4346 this . hmr = hmr ;
Original file line number Diff line number Diff line change @@ -378,7 +378,7 @@ export class Options {
378378 }
379379
380380 private isHmrEnabled ( ) : boolean {
381- if ( process . argv . includes ( "--no-hmr" ) ) {
381+ if ( this . isHmrExplicitlyDisabled ( ) ) {
382382 return false ;
383383 }
384384
@@ -388,6 +388,19 @@ export class Options {
388388 ) ;
389389 }
390390
391+ private isHmrExplicitlyDisabled ( ) : boolean {
392+ return hideBin ( process . argv ) . some ( ( arg ) => {
393+ if ( arg !== "--no-hmr" && arg !== "--noHmr" ) {
394+ return (
395+ arg === "--no-hmr=true" ||
396+ arg === "--noHmr=true"
397+ ) ;
398+ }
399+
400+ return true ;
401+ } ) ;
402+ }
403+
391404 private isTruthyBooleanValue ( value : unknown ) : boolean {
392405 return value === true || value === "true" ;
393406 }
You can’t perform that action at this time.
0 commit comments