1

Build project in Angular7.
After build through command ng-build --prod --base-href /client/product/v2/

deploy in vs folder, but folder structure is : www.domain.com/client/product/vs

All the images are in assets folder and after build assets folder is in root.

After deployment, all the images path are broken. some images are ../../imagename.png and some through css ../imagename.png.

any idea how to fix this path issue? TIA

faisaljanjua
  • 886
  • 2
  • 13
  • 28

1 Answers1

2

Fast foward to 2022, my problem and solution is as following:

Wrong way: using "../assets/something.png" or "../../assets/something.png" works fine with ng serve, but not with ng build, like this

    <img src="../assets/something.png>

Right way: easily using "asset/someting.png" works fine with both ng serve and ng build, like this

    <img src="assets/something.png>
yz lv
  • 100
  • 7