Angular-cli: --proxy-config option missing in new ng e2e

Created on 13 Apr 2018  路  5Comments  路  Source: angular/angular-cli

Versions

cli 6.0.0-rc.4

Repro steps

  • npm i @angular/cli@next -g
  • ng new helloworld
  • add --proxy-config proxy.config.json to npm e2e script in package.json
  • cd helloworld
  • npm run e2e

Observed behavior

Unknown option: '--proxyConfig'

Desired behavior

ng e2e should continue to support a proxy config as before.

Mention any other details that might be useful (optional)

Works with ng serve.

Most helpful comment

Looks like ng e2e is now taking options directly from ng serve options. For info, you need to config your angular.json like this:

"serve": {
  "options": {
    "browserTarget": "appname:build",
    "proxyConfig": "proxy.conf.json"
   }
}

All 5 comments

Looks like ng e2e is now taking options directly from ng serve options. For info, you need to config your angular.json like this:

"serve": {
  "options": {
    "browserTarget": "appname:build",
    "proxyConfig": "proxy.conf.json"
   }
}

Hi @cyrilletuzi
I am not sure about latest version of Angular CLI, but in version 1.6.5 you can add a proxy to protractor by a command line like this:
(package.json)
"e2e": "ng e2e --proxy-config proxy.conf.json",
Not sure why it was not documented in the wiki, it looks like a 'natural' way of adding a proxy - similar to the ng serve.

You can also make a separate "option" in your angular.json like this:

"e2e": {
    "builder": "@angular-devkit/build-angular:dev-server",
    "options": {
       "browserTarget": "appname:build",
       "proxyConfig": "src/proxy.conf.json"
     }
}

for .angular-cli.json i added

"serve": {
"port": 4200,
"host": "localhost",
"proxyConfig": "./proxy.conf.json"
}

thanks @cyrilletuzi

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JanStureNielsen picture JanStureNielsen  路  3Comments

jmurphzyo picture jmurphzyo  路  3Comments

hareeshav picture hareeshav  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

naveedahmed1 picture naveedahmed1  路  3Comments