Disable inline images for images that are less than 10,000 bytes
See original GitHub issueThanks for this awesome project.
I recently get a warning during build telling me:
The bundle size is significantly larger than recommended.
Consider reducing it with code splitting: https://goo.gl/9VhYWB
You can also analyze the project dependencies: https://goo.gl/LeUzfb
Analyzing the project dependencies, I discovered that the easiest and most significant improvement would be to get rid of these small images under 10,000 bytes that are imported as Data URI by webpack (it’s 25% of the size of my app).
I don’t see an option to disable the feature. Does it exists? If no I have currently 2 options that are:
- moving the images in the public folder
- ejecting the app
Both options are a big loss so an option to change the current behaviour would be nice.
Thanks for your help
Issue Analytics
- State:
- Created 6 years ago
- Reactions:10
- Comments:14 (1 by maintainers)
Top Results From Across the Web
Disable inline images for images that are less than 10000 bytes
Disable inline images for images that are less than 10000 bytes. ... The bundle size is significantly larger than recommended. Consider reducing it...
Read more >Gatsby - Prevent small images from being inlined as a data URI
This is a documented optimization for images <10,000 bytes, so it may be a negligible difference that they are all loaded here.
Read more >Solved: Remove email signature image attachments
The first filter is the image Attachment Name doesn't contain the word image, and the attachment size is greater than 10000 bytes (10kb)....
Read more >Simple method for removing inline images? - Google Groups
John Weiss. > inline images. > remove such images from emails, but IIRC the method is quite cumbersome. text only (no HTML).
Read more >Best Practices on How to Compress Images For Reactjs
If your images are less than 10 kB (10,000 bytes) these images will be converted into inline base 64 strings. So they will...
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
Another point to consider when using url-loader’s inlining: small changes in either CRA’s chosen threshold, or asset sizes in an app can mean a previously working Content-Security-Policy ends up blocking newly-inlined assets due to lack of
data:
in theimg-src
CSP policy directive.For sites that have correct long-lived cache control headers (especially those remembering to use the
immutable
directive), and aren’t as concerned about the initial cold cache case, IMO never inlining is preferable.Pile on reason: I realized a .png was being added as “data:” instead of using a path. At first I thought it was the file type because the same image as a .jpg worked. I don’t want to have to add “data:” to my CSP as it’s not recommended for security reasons. I’d like to be able to basically disable this feature all together and always use the image path.