Skip to content

Commit

Permalink
refactor(@angular-devkit/build-angular): pass full extensions to appl…
Browse files Browse the repository at this point in the history
…ication builder for dev server

Experimental programmatically added build extensions are now passed to the internal application builder
when used with the development server. Previously, the plugins were not passed in a manner that would
allow them to be used if the `application` builder was selected as the builder for dev server usage.
  • Loading branch information
clydin committed Dec 19, 2023
1 parent d263cb2 commit 9d7d136
Showing 1 changed file with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { renderPage } from '../../utils/server-rendering/render-page';
import { getSupportedBrowsers } from '../../utils/supported-browsers';
import { getIndexOutputFile } from '../../utils/webpack-browser-config';
import { buildApplicationInternal } from '../application';
import { ApplicationBuilderInternalOptions } from '../application/options';
import { buildEsbuildBrowser } from '../browser-esbuild';
import { Schema as BrowserBuilderOptions } from '../browser-esbuild/schema';
import type { NormalizedDevServerOptions } from './options';
Expand Down Expand Up @@ -148,19 +149,23 @@ export async function* serveWithVite(

const build =
builderName === '@angular-devkit/build-angular:browser-esbuild'
? buildEsbuildBrowser
: buildApplicationInternal;
? buildEsbuildBrowser.bind(
undefined,
browserOptions,
context,
{ write: false },
extensions?.buildPlugins,
)
: buildApplicationInternal.bind(
undefined,
browserOptions as ApplicationBuilderInternalOptions,
context,
{ write: false },
{ codePlugins: extensions?.buildPlugins },
);

// TODO: Switch this to an architect schedule call when infrastructure settings are supported
for await (const result of build(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
browserOptions as any,
context,
{
write: false,
},
extensions?.buildPlugins,
)) {
for await (const result of build()) {
assert(result.outputFiles, 'Builder did not provide result files.');

// If build failed, nothing to serve
Expand Down

0 comments on commit 9d7d136

Please sign in to comment.