In my webpack configuration, I have
{
test: /\.(woff|ttf|otf|eot|woff2|png|svg)$/i,
loader: 'file-loader',
}
which correctly reads the file and produced a hash when I attempt to import the file (this is the console.log of the import)
8c0ac5df695d44661b940bfba0814236.svg
Now the problem is when I pass this url to a styled component, it doesn't display it. Here is my folder structure
src
components
component1
index
styled
icons
svg
send.svg
I import the svg file from the index like this (all imports are relative to the src)
import send from 'icons/svg/send.svg';
and then use a styled component which accepts the URL:
export const FooterButton = styled.div`
mask: url(${props => props.icon}) ;
-webkit-mask-size: contain;
`;