Skip to content

Commit 7b8d6cd

Browse files
committed
fix(@angular-devkit/build-angular): handle updates of an npm link library from another workspace when preserveSymlinks is true
Prior to this change, watching of an `npm link` of a library in another workspace when `preserveSymlinks` was set to `true` was not being picked up as `node_modules` files were always ignored. Closes #25753 (cherry picked from commit 2909daf)
1 parent 9300248 commit 7b8d6cd

File tree

1 file changed

+15
-9
lines changed
  • packages/angular_devkit/build_angular/src/builders/application

1 file changed

+15
-9
lines changed

packages/angular_devkit/build_angular/src/builders/application/build-action.ts

+15-9
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,27 @@ export async function* runEsBuildBuildAction(
7676
logger.info('Watch mode enabled. Watching for file changes...');
7777
}
7878

79+
const ignored: string[] = [
80+
// Ignore the output and cache paths to avoid infinite rebuild cycles
81+
outputPath,
82+
cacheOptions.basePath,
83+
`${workspaceRoot.replace(/\\/g, '/')}/**/.*/**`,
84+
];
85+
86+
if (!preserveSymlinks) {
87+
// Ignore all node modules directories to avoid excessive file watchers.
88+
// Package changes are handled below by watching manifest and lock files.
89+
// NOTE: this is not enable when preserveSymlinks is true as this would break `npm link` usages.
90+
ignored.push('**/node_modules/**');
91+
}
92+
7993
// Setup a watcher
8094
const { createWatcher } = await import('../../tools/esbuild/watcher');
8195
watcher = createWatcher({
8296
polling: typeof poll === 'number',
8397
interval: poll,
8498
followSymlinks: preserveSymlinks,
85-
ignored: [
86-
// Ignore the output and cache paths to avoid infinite rebuild cycles
87-
outputPath,
88-
cacheOptions.basePath,
89-
// Ignore all node modules directories to avoid excessive file watchers.
90-
// Package changes are handled below by watching manifest and lock files.
91-
'**/node_modules/**',
92-
`${workspaceRoot.replace(/\\/g, '/')}/**/.*/**`,
93-
],
99+
ignored,
94100
});
95101

96102
// Setup abort support

0 commit comments

Comments
 (0)