Skip to content

Production build not load svg #7996

@adelloste

Description

@adelloste

Hello,
I have a problem with svg.
This is my steps:

  1. run ng build --prod --base-href /my/app/ (it compiles the application into an dist directory)
  2. load dist directory on server
  3. navigate the app from browser
  4. not show svgs

Locally with ng serve it works namely it shows all the svg.
I see that in dist directory there are all the svg.
This is the code in template:

<div class="wrapper-img">
     <img src="./assets/img/name.svg" class="img-responsive"/>
</div>

To clarify, I don't have this problem with png or jpg.
How can I fix it? Thanks.

Versions.

@angular/cli: 1.2.1
node: 6.10.1
os: win32 x64
@angular/animations: 4.4.4
@angular/cli: 1.2.1
@angular/common: 4.4.4
@angular/compiler: 4.4.4
@angular/compiler-cli: 4.4.4
@angular/core: 4.4.4
@angular/forms: 4.4.4
@angular/platform-browser: 4.4.4
@angular/platform-browser-dynamic: 4.4.4
@angular/router: 4.4.4
@angular/language-service: 4.4.4

Repro steps.

  1. Run --> ng build prod --base-href ./
  2. Load content in dist folder on apache

Desired functionality.

  1. See svg

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: repro stepsWe cannot reproduce the issue with the information given

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions