Skip to content

Commit 2909daf

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
1 parent fe51926 commit 2909daf

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,27 @@ export async function* runEsBuildBuildAction(
7777
logger.info('Watch mode enabled. Watching for file changes...');
7878
}
7979

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

97103
// Setup abort support

0 commit comments

Comments
 (0)