Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): handle updates of an npm link l…
Browse files Browse the repository at this point in the history
…ibrary 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
  • Loading branch information
alan-agius4 committed Dec 11, 2023
1 parent fe51926 commit 2909daf
Showing 1 changed file with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,27 @@ export async function* runEsBuildBuildAction(
logger.info('Watch mode enabled. Watching for file changes...');
}

const ignored: string[] = [
// Ignore the output and cache paths to avoid infinite rebuild cycles
outputPath,
cacheOptions.basePath,
`${workspaceRoot.replace(/\\/g, '/')}/**/.*/**`,
];

if (!preserveSymlinks) {
// Ignore all node modules directories to avoid excessive file watchers.
// Package changes are handled below by watching manifest and lock files.
// NOTE: this is not enable when preserveSymlinks is true as this would break `npm link` usages.
ignored.push('**/node_modules/**');
}

// Setup a watcher
const { createWatcher } = await import('../../tools/esbuild/watcher');
watcher = createWatcher({
polling: typeof poll === 'number',
interval: poll,
followSymlinks: preserveSymlinks,
ignored: [
// Ignore the output and cache paths to avoid infinite rebuild cycles
outputPath,
cacheOptions.basePath,
// Ignore all node modules directories to avoid excessive file watchers.
// Package changes are handled below by watching manifest and lock files.
'**/node_modules/**',
`${workspaceRoot.replace(/\\/g, '/')}/**/.*/**`,
],
ignored,
});

// Setup abort support
Expand Down

0 comments on commit 2909daf

Please sign in to comment.