diff --git a/packages/angular_devkit/build_angular/src/utils/environment-options.ts b/packages/angular_devkit/build_angular/src/utils/environment-options.ts index 9db966c6171f..22dd7b99b17a 100644 --- a/packages/angular_devkit/build_angular/src/utils/environment-options.ts +++ b/packages/angular_devkit/build_angular/src/utils/environment-options.ts @@ -100,5 +100,9 @@ export const useLegacySass: boolean = (() => { const debugPerfVariable = process.env['NG_BUILD_DEBUG_PERF']; export const debugPerformance = isPresent(debugPerfVariable) && isEnabled(debugPerfVariable); +// Default to true on Windows to workaround Visual Studio atomic file saving watch issues const watchRootVariable = process.env['NG_BUILD_WATCH_ROOT']; -export const shouldWatchRoot = isPresent(watchRootVariable) && isEnabled(watchRootVariable); +export const shouldWatchRoot = + process.platform === 'win32' + ? !isPresent(watchRootVariable) || !isDisabled(watchRootVariable) + : isPresent(watchRootVariable) && isEnabled(watchRootVariable);