File tree 2 files changed +13
-11
lines changed
packages/angular_devkit/build_angular/src
2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,11 @@ async function initialize(
52
52
namedChunks : true ,
53
53
extractLicenses : false ,
54
54
outputHashing : OutputHashing . None ,
55
+ // The webpack tier owns the watch behavior so we want to force it in the config.
56
+ // When not in watch mode, webpack-dev-middleware will call `compiler.watch` anyway.
57
+ // https://github.com/webpack/webpack-dev-middleware/blob/698c9ae5e9bb9a013985add6189ff21c1a1ec185/src/index.js#L65
58
+ // https://github.com/webpack/webpack/blob/cde1b73e12eb8a77eb9ba42e7920c9ec5d29c2c9/lib/Compiler.js#L379-L388
59
+ watch : true ,
55
60
} ,
56
61
context ,
57
62
wco => [
@@ -86,13 +91,16 @@ export function execute(
86
91
// Check Angular version.
87
92
assertCompatibleAngularVersion ( context . workspaceRoot , context . logger ) ;
88
93
94
+ let singleRun : boolean | undefined ;
95
+ if ( options . watch !== undefined ) {
96
+ singleRun = ! options . watch ;
97
+ }
98
+
89
99
return from ( initialize ( options , context , transforms . webpackConfiguration ) ) . pipe (
90
100
switchMap ( async ( [ karma , webpackConfig ] ) => {
91
- const karmaOptions : KarmaConfigOptions = { } ;
92
-
93
- if ( options . watch !== undefined ) {
94
- karmaOptions . singleRun = ! options . watch ;
95
- }
101
+ const karmaOptions : KarmaConfigOptions = {
102
+ singleRun,
103
+ } ;
96
104
97
105
// Convert browsers from a string to an array
98
106
if ( options . browsers ) {
Original file line number Diff line number Diff line change @@ -128,12 +128,6 @@ const init: any = (config: any, emitter: any) => {
128
128
config . middleware = config . middleware || [ ] ;
129
129
config . middleware . push ( '@angular-devkit/build-angular--fallback' ) ;
130
130
131
- // The webpack tier owns the watch behavior so we want to force it in the config.
132
- // When not in watch mode, webpack-dev-middleware will call `compiler.watch` anyway.
133
- // https://github.com/webpack/webpack-dev-middleware/blob/698c9ae5e9bb9a013985add6189ff21c1a1ec185/src/index.js#L65
134
- // https://github.com/webpack/webpack/blob/cde1b73e12eb8a77eb9ba42e7920c9ec5d29c2c9/lib/Compiler.js#L379-L388
135
- webpackConfig . watch = true ;
136
-
137
131
if ( config . singleRun ) {
138
132
// There's no option to turn off file watching in webpack-dev-server, but
139
133
// we can override the file watcher instead.
You can’t perform that action at this time.
0 commit comments