Skip to content

Commit 2391c87

Browse files
committed
refactor(@angular-devkit/build-angular): remove Webpack-specific index option helper from Vite-based dev-server
The index output option helper from within the Webpack-based build system has been removed from the Vite-based development server code to support separation of the builder. This information will eventually be passed via the build system results and the direct option access can then be removed completely.
1 parent 1cebc3a commit 2391c87

File tree

1 file changed

+8
-4
lines changed
  • packages/angular_devkit/build_angular/src/builders/dev-server

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@ import type { json } from '@angular-devkit/core';
2323
import type { Plugin } from 'esbuild';
2424
import assert from 'node:assert';
2525
import { readFile } from 'node:fs/promises';
26-
import { join } from 'node:path';
26+
import { basename, join } from 'node:path';
2727
import type { Connect, DepOptimizationConfig, InlineConfig, ViteDevServer } from 'vite';
2828
import { createAngularMemoryPlugin } from '../../tools/vite/angular-memory-plugin';
2929
import { createAngularLocaleDataPlugin } from '../../tools/vite/i18n-locale-plugin';
3030
import { loadProxyConfiguration, normalizeSourceMaps } from '../../utils';
3131
import { loadEsmModule } from '../../utils/load-esm';
32-
import { getIndexOutputFile } from '../../utils/webpack-browser-config';
3332
import { buildEsbuildBrowser } from '../browser-esbuild';
3433
import { Schema as BrowserBuilderOptions } from '../browser-esbuild/schema';
3534
import type { NormalizedDevServerOptions } from './options';
@@ -131,8 +130,13 @@ export async function* serveWithVite(
131130

132131
// Extract output index from options
133132
// TODO: Provide this info from the build results
134-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
135-
const htmlIndexPath = getIndexOutputFile(browserOptions.index as any);
133+
let htmlIndexPath = 'index.html';
134+
if (browserOptions.index && typeof browserOptions.index !== 'boolean') {
135+
htmlIndexPath =
136+
typeof browserOptions.index === 'string'
137+
? basename(browserOptions.index)
138+
: browserOptions.index.output || 'index.html';
139+
}
136140

137141
// dynamically import Vite for ESM compatibility
138142
const { createServer, normalizePath } = await loadEsmModule<typeof import('vite')>('vite');

0 commit comments

Comments
 (0)