Skip to content

Production build css url does not use data URI scheme #13355

Closed
@petarnikolovski

Description

@petarnikolovski

After upgrading to angular 7 (from angular 6) CSS urls are no longer having data URI in production build. All images on my site are broken when I deploy the app.

Bug Report or Feature Request (mark with an x)

- [x] bug report
- [ ] feature request

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Linux: Ubuntu 16.04
Node: v10.14.2
npm: 6.4.1

ng --version:

@angular-devkit/architect         0.11.0
@angular-devkit/build-angular     0.11.0
@angular-devkit/build-optimizer   0.11.0
@angular-devkit/build-webpack     0.11.0
@angular-devkit/core              7.1.0
@angular-devkit/schematics        7.1.3
@angular/cdk                      7.2.0
@angular/cli                      7.1.3
@angular/material                 7.2.0
@ngtools/webpack                  7.1.0
@schematics/angular               7.1.3
@schematics/update                0.11.3
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.23.1

Repro steps

I define my css image urls as e.g.

.resize {
  background-image: url("../../assets/symbol.png");
}

And after ng build --prod

The url on my live server is rendered as:

.resize {
  background-image: url("data:image/png;base64...");
}

However, after the upgrade to angular 7, the url becomes:

.resize {
  background-image: url("symbol.png");
}

The log given by the failure

No log.

Desired functionality

I want to be able to use data URI instead of relative/absolute url, when production build is compiled.

Mention any other details that might be useful

  • My base href is set to "/" in all config files - I musn't change it because it would break all my API calls
  • Probably unrelated, but since the upgrade when I try to create new component, I get Two or more projects are using identical roots. Unable to determine project using current working directory. Using default workspace project instead. warning

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions