How to load images and other static assets?
See original GitHub issueHello,
What is the best way to load images and other assets that will work for both client & server?
I could add url-loader
and file-loader
to webpack config but it will not work on the server.
Are there other options?
Thanks, Ran.
Issue Analytics
- State:
- Created 7 years ago
- Comments:17 (11 by maintainers)
Top Results From Across the Web
How to manage static files (e.g. images, JavaScript, CSS)
Store your static files in a folder called static in your app. For example my_app/static/my_app/example. jpg .
Read more >Images, fonts, and assets - Storybook - JS.ORG
We recommend serving static files via Storybook to ensure that your components always have the assets they need to load. We recommend this...
Read more >Static Assets - Docusaurus
Static assets are the non-code files that are directly copied to the build output. They include images, stylesheets, favicons, fonts, etc. By ...
Read more >Using the Static Folder - Gatsby
In general, every website needs assets: images, stylesheets, scripts, etc. ... Every file you put into that folder will be copied into the...
Read more >Basic Features: Static File Serving - Next.js
Next.js can serve static files, like images, under a folder called public in the root directory. Files inside public can then be referenced...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@justingreenberg babel-register can’t handle the image file types, a workaround is to modify server:
@jaredpalmer hey man, thanks for the awesome kit 😃 i’m sorry to drudge this back up, but may i ask how you are handling SSR images/statics like fonts in your projects? for example, how are you approaching:
i’ve been using
webpack-isomorphic-tools
to handle above cases, which works but the ergonomics and setup feels very brittle and hacky… i’m about to start another project, it would be really great to hear your thoughts and approach—it feels likeassets.json
could be used for statics as wellthanks again jared, any direction, boilerplate or webpack config you could provide would be greatly appreciated, and i’d be happy to submit a PR if it’s something you want to add to starter
i suspect i’m probably overlooking a super simple solution… thanks again!! 😃