jacobmischka / gatsby-plugin-react-svg

Adds svg-react-loader to gatsby webpack config
https://www.npmjs.com/package/gatsby-plugin-react-svg
MIT License
70 stars 21 forks source link

Dynamic imports #31

Open haniotis opened 4 years ago

haniotis commented 4 years ago

Is there a way to use dynamic imports? I'm trying to achieve something like this:

Icon.js component <Container src={require(`static/icons/${icon}.svg`)} raw />

In use <Icon icon="twitter" />

The idea is to call a single Icon component and just reference the icon names as opposed to importing individual assets

Thanks!

polnikale commented 3 years ago

Hello. Are there any updates on this?

jacobmischka commented 3 years ago

Nope! Pull requests welcome!