Skip to content

Commit

Permalink
fix(serve): use proxyConfig option from serve
Browse files Browse the repository at this point in the history
This option was in the schema because originally `--proxy-config` was an
option provided by the Ionic CLI. Before this change, `proxyConfig` was
overriding the dev-server's `proxyConfig` option, even when undefined.

fixes ionic-team/ionic-cli#3825
  • Loading branch information
imhoffd committed Jan 24, 2019
1 parent 6c7ca09 commit 859ce96
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
7 changes: 4 additions & 3 deletions builders/cordova-serve/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@ export class CordovaServeBuilder implements Builder<CordovaServeBuilderSchema> {

run(builderConfig: BuilderConfiguration<CordovaServeBuilderSchema>): Observable<BuildEvent> {
const { options: cordovaServeOptions } = builderConfig;
const { devServerTarget, port, host, ssl, proxyConfig } = cordovaServeOptions;
const { devServerTarget, port, host, ssl } = cordovaServeOptions;
const [ project, target, configuration ] = devServerTarget.split(':');

const devServerTargetSpec = { project, target, configuration, overrides: { port, host, ssl, proxyConfig } };
const devServerTargetSpec = { project, target, configuration, overrides: { port, host, ssl } };
const devServerBuilderConfig = this.context.architect.getBuilderConfiguration<DevServerBuilderOptions>(devServerTargetSpec);

let devServerDescription: BuilderDescription;
let cordovaBuildConfig: BuilderConfiguration<CordovaBuildBuilderSchema>;

return this.context.architect.getBuilderDescription(devServerBuilderConfig).pipe(
return of(null).pipe(
concatMap(() => this.context.architect.getBuilderDescription(devServerBuilderConfig)),
tap(description => devServerDescription = description),
concatMap(() => this.context.architect.validateBuilderOptions(devServerBuilderConfig, devServerDescription)),
concatMap(() => this._getCordovaBuildConfig(cordovaServeOptions)),
Expand Down
1 change: 0 additions & 1 deletion builders/cordova-serve/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export interface CordovaServeBuilderSchema {
port?: number;
host?: string;
ssl?: boolean;
proxyConfig?: string;
cordovaBasePath?: string;
sourceMap?: boolean;
}
4 changes: 0 additions & 4 deletions builders/cordova-serve/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
"type": "string",
"description": "Cordova platform to use during serve."
},
"proxyConfig": {
"type": "string",
"description": "Proxy configuration file."
},
"ssl": {
"type": "boolean",
"description": "Serve using HTTPS.",
Expand Down

0 comments on commit 859ce96

Please sign in to comment.