Skip to content

Commit b361a97

Browse files
Alanmgechev
Alan
authored andcommitted
fix(@angular-devkit/build-angular): absolute outputPath outputs index.html in wrong location
Fixes #14474
1 parent fda698a commit b361a97

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

packages/angular_devkit/build_angular/src/browser/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export function buildWebpackBrowser(
245245

246246
return writeIndexHtml({
247247
host,
248-
outputPath: join(root, options.outputPath),
248+
outputPath: resolve(root, normalize(options.outputPath)),
249249
indexPath: join(root, options.index),
250250
files,
251251
noModuleFiles,

packages/angular_devkit/build_angular/test/browser/output-path_spec_large.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*/
88

99
import { Architect } from '@angular-devkit/architect';
10-
import { join, virtualFs } from '@angular-devkit/core';
11-
import { createArchitect, host } from '../utils';
10+
import { getSystemPath, join, virtualFs } from '@angular-devkit/core';
11+
import { browserBuild, createArchitect, host } from '../utils';
1212

1313

1414
describe('Browser Builder output path', () => {
@@ -48,4 +48,13 @@ describe('Browser Builder output path', () => {
4848
} catch {}
4949
await run.stop();
5050
});
51+
52+
it('works with absolute outputPath', async () => {
53+
const overrides = {
54+
outputPath: getSystemPath(join(host.root(), 'dist')),
55+
};
56+
const { files } = await browserBuild(architect, host, target, overrides);
57+
expect('main.js' in files).toBe(true);
58+
expect('index.html' in files).toBe(true);
59+
});
5160
});

0 commit comments

Comments
 (0)