question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disable inline images for images that are less than 10,000 bytes

See original GitHub issue

Thanks 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:closed
  • Created 6 years ago
  • Reactions:10
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
edmorleycommented, Mar 15, 2018

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 the img-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.

4reactions
Kizmarcommented, Apr 10, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found