Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.

baseHref/deployUrl option for universal build in @angular-devkit/build-angular:server #986

Closed
nishesj opened this issue May 30, 2018 · 1 comment

Comments

@nishesj
Copy link

nishesj commented May 30, 2018

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Area

- [ x] devkit
- [ ] schematics

Versions

angular-devkit/architect 0.6.5

Repro steps

Cannot pass baseHref or deployUrl option when running
ng run web:server:production
which contains

 "server": {
          "builder": "@angular-devkit/build-angular:server",
          "options": {
            "outputPath": "dist/server",
            "main": "src/main.server.ts",
            "tsConfig": "src/tsconfig.server.json"
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            }
          }
        }

Which causes wrong assets path in css on the universal generated response.
Where as when doing a browser build the baseHref is properly appended in postCss processing as expected.
baseHref set to "https://cdn.example.com"


  .icon {
     background: url('/assets/icon.svg') no-repeat center center;
   }

angular-devkit/build-angular:browser-> postCss ->

 .icon {
    background: url('https://cdn.example.com/assets/icon.svg') no-repeat center center;
  }

angular-devkit/build-angular:server -> postCss -> no change which leads to wrong URL in first initial server rendered response in combination to html base href tag

Desired functionality

The postcss step in server build should append the path with baseUrl or deployUrl as in browserBuild
so that the initial response generated by universal has correct path to assets if relative URL is used

@alexeagle
Copy link
Contributor

This issue was moved to angular/angular-cli#12093

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants