Skip to content

Commit 4ff095a

Browse files
committed
fix(@angular-devkit/build-angular): addresses issue were deployUrl has no effect with serve
Closes #11952
1 parent b19a348 commit 4ff095a

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

packages/angular_devkit/build_angular/src/dev-server/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export interface DevServerBuilderOptions {
5555
vendorChunk?: boolean;
5656
commonChunk?: boolean;
5757
baseHref?: string;
58+
deployUrl?: string;
5859
progress?: boolean;
5960
poll?: number;
6061
verbose?: boolean;
@@ -333,7 +334,7 @@ export class DevServerBuilder implements Builder<DevServerBuilderOptions> {
333334
let servePath = options.servePath;
334335
if (!servePath && servePath !== '') {
335336
const defaultServePath =
336-
this._findDefaultServePath(browserOptions.baseHref, browserOptions.deployUrl);
337+
this._findDefaultServePath(browserOptions.baseHref, options.deployUrl);
337338
const showWarning = options.servePathDefaultWarning;
338339
if (defaultServePath == null && showWarning) {
339340
this.context.logger.warn(tags.oneLine`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
import { request, runTargetSpec } from '@angular-devkit/architect/testing';
10+
import { from } from 'rxjs';
11+
import { concatMap, take, tap } from 'rxjs/operators';
12+
import { DevServerBuilderOptions } from '../../src';
13+
import { devServerTargetSpec, host } from '../utils';
14+
15+
16+
describe('Dev Server Deploy Url', () => {
17+
beforeEach(done => host.initialize().toPromise().then(done, done.fail));
18+
afterEach(done => host.restore().toPromise().then(done, done.fail));
19+
20+
it('works', (done) => {
21+
const overrides: Partial<DevServerBuilderOptions> = { deployUrl: 'test/' };
22+
23+
runTargetSpec(host, devServerTargetSpec, overrides).pipe(
24+
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
25+
concatMap(() => from(request('http://localhost:4200/test/polyfills.js'))),
26+
tap(response => expect(response).toContain('window["webpackJsonp"]')),
27+
take(1),
28+
).toPromise().then(done, done.fail);
29+
}, 30000);
30+
});

0 commit comments

Comments
 (0)