Skip to content

Commit 99cbcea

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export function buildWebpackBrowser(
223223

224224
return writeIndexHtml({
225225
host,
226-
outputPath: join(root, options.outputPath),
226+
outputPath: resolve(root, normalize(options.outputPath)),
227227
indexPath: join(root, options.index),
228228
ES5BuildFiles,
229229
ES2015BuildFiles,

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

Lines changed: 11 additions & 2 deletions
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)