The picture cannot be loaded after angular5 background-img is packaged.

.invoice-img-unselected {
    background-image: url("/assets/imgs/invoice-bg.png");
}

the background image cannot be loaded after being packaged with ng build

clipboard.png

Mar.09,2021

well, this is a path problem, which has nothing to do with packing.
background-image: url (". / assets/imgs/invoice-bg.png") if it is relative to the current file;
otherwise / represents a directory

-- you need to see if there is a picture under the Request URL path, but you haven't asked to see what the problem is.


write relative path.

    background: url(../../assets/imgs/invoice-bg.png)
Menu