Search code examples
angularangular-cliangular-cli-v6

ng serve live reload doesn't work in script


When I just go with ng serve it detects my changes and reloads the page.
However, if I try using npm run myStartScript it does not.
myStartScript:

ng serve --deploy-url https://localhost:4200/ --ssl true --ssl-key \"my_store.key\"  --ssl-cert \"my_key_store.crt\"

Versions:

Angular CLI: 6.0.8
Node: 8.11.2
OS: win32 x64
Angular: 6.0.4

Edit: I did some more tests. Pointing my browser directly at localhost:4200 works regardless of which ng serve command I use. But when I launch my project on a remote server (where the scripts are being pulled from localhost) it doesn't automatically reload.
In a previous project using the exact same configuration this worked. The only difference is the Angular version (4 vs. 6) and the Angular CLI version (1.0 vs. 6).


Solution

  • Took a while, but I found the problem.
    In an unrelated issue, I was getting a 404 from sockjs-node.
    The fix is as presented here: https://github.com/angular/angular-cli/issues/8487#issuecomment-344665930

    So apparently the WDS was choking on the error and refused to acknowledge requests to refresh the page. Resolving the sockjs-node error fixed my problem.