Commit fed31e0 1 parent f410835 commit fed31e0 Copy full SHA for fed31e0
File tree 6 files changed +16
-11
lines changed
angular/build/src/builders/dev-server
angular_devkit/build_angular/src/builders/dev-server
6 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -114,8 +114,8 @@ export async function normalizeOptions(
114
114
open,
115
115
verbose,
116
116
watch,
117
- liveReload,
118
- hmr,
117
+ liveReload : ! ! liveReload ,
118
+ hmr : hmr ?? ! ! liveReload ,
119
119
headers,
120
120
workspaceRoot,
121
121
projectRoot,
Original file line number Diff line number Diff line change 67
67
},
68
68
"hmr" : {
69
69
"type" : " boolean" ,
70
- "description" : " Enable hot module replacement." ,
71
- "default" : false
70
+ "description" : " Enable hot module replacement. Defaults to the value of 'liveReload'. Currently, only global and component stylesheets are supported."
72
71
},
73
72
"watch" : {
74
73
"type" : " boolean" ,
Original file line number Diff line number Diff line change @@ -137,8 +137,9 @@ export async function* serveWithVite(
137
137
process . setSourceMapsEnabled ( true ) ;
138
138
}
139
139
140
- // Enable to support component style hot reloading (`NG_HMR_CSTYLES=0` can be used to disable)
141
- browserOptions . externalRuntimeStyles = ! ! serverOptions . liveReload && useComponentStyleHmr ;
140
+ // Enable to support component style hot reloading (`NG_HMR_CSTYLES=0` can be used to disable selectively)
141
+ browserOptions . externalRuntimeStyles =
142
+ serverOptions . liveReload && serverOptions . hmr && useComponentStyleHmr ;
142
143
143
144
// Enable to support component template hot replacement (`NG_HMR_TEMPLATE=1` can be used to enable)
144
145
browserOptions . templateUpdates = ! ! serverOptions . liveReload && useComponentTemplateHmr ;
@@ -466,7 +467,7 @@ async function handleUpdate(
466
467
return ;
467
468
}
468
469
469
- if ( serverOptions . liveReload || serverOptions . hmr ) {
470
+ if ( serverOptions . hmr ) {
470
471
if ( updatedFiles . every ( ( f ) => f . endsWith ( '.css' ) ) ) {
471
472
const timestamp = Date . now ( ) ;
472
473
server . ws . send ( {
Original file line number Diff line number Diff line change @@ -85,12 +85,15 @@ export function execute(
85
85
) ;
86
86
}
87
87
88
+ // New build system defaults hmr option to the value of liveReload
89
+ normalizedOptions . hmr ??= normalizedOptions . liveReload ;
90
+
88
91
return defer ( ( ) =>
89
92
Promise . all ( [ import ( '@angular/build/private' ) , import ( '../browser-esbuild' ) ] ) ,
90
93
) . pipe (
91
94
switchMap ( ( [ { serveWithVite, buildApplicationInternal } , { convertBrowserOptions } ] ) =>
92
95
serveWithVite (
93
- normalizedOptions ,
96
+ normalizedOptions as typeof normalizedOptions & { hmr : boolean } ,
94
97
builderName ,
95
98
( options , context , codePlugins ) => {
96
99
return builderName === '@angular-devkit/build-angular:browser-esbuild'
@@ -124,6 +127,9 @@ export function execute(
124
127
) ;
125
128
}
126
129
130
+ // Webpack based build systems default to false for hmr option
131
+ normalizedOptions . hmr ??= false ;
132
+
127
133
// Use Webpack for all other browser targets
128
134
return defer ( ( ) => import ( './webpack-server' ) ) . pipe (
129
135
switchMap ( ( { serveWebpackBrowser } ) =>
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export async function normalizeOptions(
116
116
open,
117
117
verbose,
118
118
watch,
119
- liveReload,
119
+ liveReload : ! ! liveReload ,
120
120
hmr,
121
121
headers,
122
122
workspaceRoot,
Original file line number Diff line number Diff line change 84
84
},
85
85
"hmr" : {
86
86
"type" : " boolean" ,
87
- "description" : " Enable hot module replacement." ,
88
- "default" : false
87
+ "description" : " Enable hot module replacement."
89
88
},
90
89
"watch" : {
91
90
"type" : " boolean" ,
You can’t perform that action at this time.
0 commit comments