angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

--proxy-config option missing in new ng e2e

Open cyrilletuzi opened this issue 8 years ago • 5 comments

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.

cyrilletuzi avatar Apr 13 '18 18:04 cyrilletuzi

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"
   }
}

cyrilletuzi avatar Apr 13 '18 21:04 cyrilletuzi

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.

bartosz-builds avatar May 04 '18 14:05 bartosz-builds

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"
     }
}

jpinxten avatar Jul 25 '18 12:07 jpinxten

for .angular-cli.json i added

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

thanks @cyrilletuzi

mcherb avatar Oct 30 '18 14:10 mcherb

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.