You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some generated files, such as JavaScript chunk files, the file name really doesn’t matter. However, other files, such as assets used for images, are more likely to be downloaded by some users. For these files, it would be nice if the file name remained as chosen by the developer, and cache busting would be implemented by putting the hash in a directory name instead of the file name.
For example, when I import avatar from './user.jpg' and then <img alt="always use alt lol" src={avatar} />, the image will be located at e.g. public/build/_assets/user-NOEI2W6T.jpg and the browser will suggest the file name user-NOEI2W6T.jpg when the user right-clicks to download the image. I think a neater solution would be to put this file in public/build/_assets/NOEI2W6T/user.jpg instead, preserving the original filename.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
For some generated files, such as JavaScript chunk files, the file name really doesn’t matter. However, other files, such as assets used for images, are more likely to be downloaded by some users. For these files, it would be nice if the file name remained as chosen by the developer, and cache busting would be implemented by putting the hash in a directory name instead of the file name.
For example, when I
import avatar from './user.jpg'
and then<img alt="always use alt lol" src={avatar} />
, the image will be located at e.g.public/build/_assets/user-NOEI2W6T.jpg
and the browser will suggest the file nameuser-NOEI2W6T.jpg
when the user right-clicks to download the image. I think a neater solution would be to put this file inpublic/build/_assets/NOEI2W6T/user.jpg
instead, preserving the original filename.Beta Was this translation helpful? Give feedback.
All reactions