Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(@angular-devkit/build-angular): directly watch package lock files in esbuild builder #24968

Merged
merged 1 commit into from Apr 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -681,18 +681,33 @@ export async function* buildEsbuildBrowser(
const watcher = createWatcher({
polling: typeof userOptions.poll === 'number',
interval: userOptions.poll,
// Ignore the output and cache paths to avoid infinite rebuild cycles
ignored: [normalizedOptions.outputPath, normalizedOptions.cacheOptions.basePath],
ignored: [
// Ignore the output and cache paths to avoid infinite rebuild cycles
normalizedOptions.outputPath,
normalizedOptions.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/**',
],
});

// Temporarily watch the entire project
watcher.add(normalizedOptions.projectRoot);

// Watch workspace root node modules
// Includes Yarn PnP manifest files (https://yarnpkg.com/advanced/pnp-spec/)
watcher.add(path.join(normalizedOptions.workspaceRoot, 'node_modules'));
watcher.add(path.join(normalizedOptions.workspaceRoot, '.pnp.cjs'));
watcher.add(path.join(normalizedOptions.workspaceRoot, '.pnp.data.json'));
// Watch workspace for package manager changes
const packageWatchFiles = [
// manifest can affect module resolution
'package.json',
// npm lock file
'package-lock.json',
// pnpm lock file
'pnpm-lock.yaml',
// yarn lock file including Yarn PnP manifest files (https://yarnpkg.com/advanced/pnp-spec/)
'yarn.lock',
'.pnp.cjs',
'.pnp.data.json',
];
watcher.add(packageWatchFiles.map((file) => path.join(normalizedOptions.workspaceRoot, file)));

// Wait for changes and rebuild as needed
try {
Expand Down