Skip to content

Commit 8daf3a5

Browse files
clydinangular-robot[bot]
authored andcommitted
perf(@angular-devkit/build-angular): only import esbuild watcher when in watch mode
When using the esbuild-based browser application builder, all the watch-related code is now only imported when the watch mode is enabled. This removes the need for Node.js to resolve and load code that will not be used.
1 parent d8ba2fe commit 8daf3a5

File tree

1 file changed

+2
-1
lines changed
  • packages/angular_devkit/build_angular/src/builders/browser-esbuild

1 file changed

+2
-1
lines changed

packages/angular_devkit/build_angular/src/builders/browser-esbuild/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { NormalizedBrowserOptions, normalizeOptions } from './options';
3232
import { shutdownSassWorkerPool } from './sass-plugin';
3333
import { Schema as BrowserBuilderOptions } from './schema';
3434
import { createStylesheetBundleOptions } from './stylesheets';
35-
import { ChangedFiles, createWatcher } from './watcher';
35+
import type { ChangedFiles } from './watcher';
3636

3737
interface RebuildState {
3838
codeRebuild?: BundlerContext;
@@ -673,6 +673,7 @@ export async function* buildEsbuildBrowser(
673673
}
674674

675675
// Setup a watcher
676+
const { createWatcher } = await import('./watcher');
676677
const watcher = createWatcher({
677678
polling: typeof userOptions.poll === 'number',
678679
interval: userOptions.poll,

0 commit comments

Comments
 (0)