angularnginxangular-cliangular-universal

Angular Universal 17 - Alternatives to deployUrl


In Angular 17 the deployUrl was removed with use with Universal and SSR. The variable allowed you to serve css, js, and the assets folder under a non-root uri. For example /my/super/awesome/app. In going through the Angular Universal 17 docs there is not a way to serve css, js, and assets from any other route than /.

Has anyone else run into this, are you just using Nginx to do rewrites to get around this?


Solution

  • This feature returned in version 17.3.0. Upgrade:

    ng update @angular/cli
    ng update @angular/core
    

    Edit angular.json

    "architect": {
      "build": {
        "options": {
          "deployUrl": "/my/super/awesome/app/"
    

    Or just:

    ng build --deploy-url=/my/super/awesome/app/
    

    See: https://github.com/angular/angular-cli/releases