Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.

fix(@angular-devkit/build-angular): make serve build options override #925

Merged
merged 1 commit into from
May 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/angular_devkit/build_angular/src/dev-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,14 +436,12 @@ export class DevServerBuilder implements Builder<DevServerBuilderOptions> {
private _getBrowserOptions(options: DevServerBuilderOptions) {
const architect = this.context.architect;
const [project, target, configuration] = options.browserTarget.split(':');
// Override browser build watch setting.
const overrides = { watch: options.watch };
const browserTargetSpec = { project, target, configuration, overrides };
const builderConfig = architect.getBuilderConfiguration<BrowserBuilderSchema>(
browserTargetSpec);

// Update the browser options with the same options we support in serve, if defined.
builderConfig.options = {
const overrides = {
// Override browser build watch setting.
watch: options.watch,

// Update the browser options with the same options we support in serve, if defined.
...(options.optimization !== undefined ? { optimization: options.optimization } : {}),
...(options.aot !== undefined ? { aot: options.aot } : {}),
...(options.sourceMap !== undefined ? { sourceMap: options.sourceMap } : {}),
Expand All @@ -453,10 +451,12 @@ export class DevServerBuilder implements Builder<DevServerBuilderOptions> {
...(options.baseHref !== undefined ? { baseHref: options.baseHref } : {}),
...(options.progress !== undefined ? { progress: options.progress } : {}),
...(options.poll !== undefined ? { poll: options.poll } : {}),

...builderConfig.options,
};

const browserTargetSpec = { project, target, configuration, overrides };
const builderConfig = architect.getBuilderConfiguration<BrowserBuilderSchema>(
browserTargetSpec);

return architect.getBuilderDescription(builderConfig).pipe(
concatMap(browserDescription =>
architect.validateBuilderOptions(builderConfig, browserDescription)),
Expand Down