I'm using React 17 and importing an image icon as below
import IconA from './myassets/images/Icona.png';
const ImgView = () => {
return (
<div>
<img src={IconA} alt="IconA" />
</div>
);
}
In HTML page its getting converted to base64 string and being rendered as
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4
//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="IconA" />
How can I load my icon in img tag without getting it converted to base64 string. I'm getting below CSP error because of above issue
Refused to load data:image/png;base64 ... because it does not appear in the img-src directive of the Content Security Policy