Closed zgjimgjonbalaj closed 3 years ago
Just realized the loader expects no leading slash in the src attribute ie
Bad: "/images/img-name.jpg" Good "images/img-name.jpg"
I think it makes sense to add a wildcard there, many of us are used to relative URLs
Likewise in SCSS
Bad: "/images/img-name.jpg" Good: "../images/img-name.jpg"
Images loaded via style and data attributes does not load in prod build
For example, images here is not rendered in prod build
<div style="background-image: url(images/slide-3d.jpg)">
<section data-image-src="images/bg-welcome.jpg">
When using images in your HTML, use the require
syntax. The interpolate
feature of html-loader
will take care of copying over whatever you require into the dist/
folder.
// Require images like so
${require('./images/photo.jpg')}
// Here's an example in your HTML
<div style="background-image: url(${require('./images/photo.jpg')})">
Describe the bug Images that are placed in the images folder but only referenced in HTML and not CSS do not get included in the production build. So far only tested with a PNG but would bet it includes others as well.
To Reproduce
Expected behavior Images that are placed in the assets folder should not be removed.
Desktop (please complete the following information):