Skip to content

Commit

Permalink
perf(@angular-devkit/build-angular): only import esbuild watcher when…
Browse files Browse the repository at this point in the history
… 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.

(cherry picked from commit 8daf3a5)
  • Loading branch information
clydin authored and dgp1130 committed Apr 11, 2023
1 parent c60d16a commit 9ea3e8e
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { NormalizedBrowserOptions, normalizeOptions } from './options';
import { shutdownSassWorkerPool } from './sass-plugin';
import { Schema as BrowserBuilderOptions } from './schema';
import { createStylesheetBundleOptions } from './stylesheets';
import { ChangedFiles, createWatcher } from './watcher';
import type { ChangedFiles } from './watcher';

interface RebuildState {
codeRebuild?: BundlerContext;
Expand Down Expand Up @@ -673,6 +673,7 @@ export async function* buildEsbuildBrowser(
}

// Setup a watcher
const { createWatcher } = await import('./watcher');
const watcher = createWatcher({
polling: typeof userOptions.poll === 'number',
interval: userOptions.poll,
Expand Down

0 comments on commit 9ea3e8e

Please sign in to comment.