CrocoDillon / universal-react-redux-boilerplate

Step by step creation of a Universal React + Redux Boilerplate
Other
176 stars 33 forks source link

Importing (or using) static files such as images (GIF, JPG, PNG, SVG)? #38

Open marcelhageman opened 7 years ago

marcelhageman commented 7 years ago

I understand that client-side webpack could resolve files (like SVG) but server-side it'll try to require() parse the files instead. Would universal-react-redux-boilerplate be any help there?

Alternatively, what's the recommended approach to loading static files? I'd like a static directory where I can put all my images and such. It's a bit unclear to me where I'm supposed to put those.

Would also be a nice addition to the documentation 😉

CrocoDillon commented 7 years ago

For SVG (if you don't mind inlining them) you can try babel-plugin-inline-react-svg

For other assets maybe babel-plugin-transform-assets

I'm currently thinking about the best approach for the static / public directory and the necessary babel plugins or webpack loaders... not sure yet what I end up with

Either way with React 16 out it's time to update this repo anyway 😄