Skip to content

Commit 9d7d136

Browse files
committed
refactor(@angular-devkit/build-angular): pass full extensions to application 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.
1 parent d263cb2 commit 9d7d136

File tree

1 file changed

+16
-11
lines changed
  • packages/angular_devkit/build_angular/src/builders/dev-server

1 file changed

+16
-11
lines changed

packages/angular_devkit/build_angular/src/builders/dev-server/vite-server.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { renderPage } from '../../utils/server-rendering/render-page';
2828
import { getSupportedBrowsers } from '../../utils/supported-browsers';
2929
import { getIndexOutputFile } from '../../utils/webpack-browser-config';
3030
import { buildApplicationInternal } from '../application';
31+
import { ApplicationBuilderInternalOptions } from '../application/options';
3132
import { buildEsbuildBrowser } from '../browser-esbuild';
3233
import { Schema as BrowserBuilderOptions } from '../browser-esbuild/schema';
3334
import type { NormalizedDevServerOptions } from './options';
@@ -148,19 +149,23 @@ export async function* serveWithVite(
148149

149150
const build =
150151
builderName === '@angular-devkit/build-angular:browser-esbuild'
151-
? buildEsbuildBrowser
152-
: buildApplicationInternal;
152+
? buildEsbuildBrowser.bind(
153+
undefined,
154+
browserOptions,
155+
context,
156+
{ write: false },
157+
extensions?.buildPlugins,
158+
)
159+
: buildApplicationInternal.bind(
160+
undefined,
161+
browserOptions as ApplicationBuilderInternalOptions,
162+
context,
163+
{ write: false },
164+
{ codePlugins: extensions?.buildPlugins },
165+
);
153166

154167
// TODO: Switch this to an architect schedule call when infrastructure settings are supported
155-
for await (const result of build(
156-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
157-
browserOptions as any,
158-
context,
159-
{
160-
write: false,
161-
},
162-
extensions?.buildPlugins,
163-
)) {
168+
for await (const result of build()) {
164169
assert(result.outputFiles, 'Builder did not provide result files.');
165170

166171
// If build failed, nothing to serve

0 commit comments

Comments
 (0)