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
{{ message }}
This repository was archived by the owner on Dec 22, 2025. It is now read-only.
As mentioned in #17, this pr replaces image paths with image imports. Imported images are included in the build result and appended a build-specific hash. The Image component requests this hash-appended path and since the hash is build-specific, the responce is able to have long max-age and the immutable directive.
However, since EquipmentImageList exports large objects, the size of / increases by 25 kB as below.
Are all the files cached? I can see a lot of images still have a short ttl instead of a maximized TTL
For EquipmentImageList.ts, setting aside the size concern, it seems like going forward, every time we add new equipment resources, we have to update this ts file as well? If so, this doesn't sound like a future-proof solution to me.
I think the best way moving forward is to move static files to another CDN and load images from there(no need to move the entire applcation, just images) - github pages might be a good candidate considering all the images are already in this repo. But I'm not sure if github CDN is as stable as vercel CDN. We have a large user base in China, so this might be a concerning point.
That being said, for now I feel like we can just keep the configuration as-is, if it works then just keep it working, wdyt?
Indeed. It seems ugly. However writing generator script feels overengineering. Rather using the header() function and images prop in the next.config.js may be a good solution?
It will work as it's working now, but also it will increase the Edge Requests in the same way. But I have no good ideas. Until we find the one, we might as well leave things as they're working.
Now I have two more solutions. One is a compromise, setting a ≈1 month length max-age to /public files using headers(). This way prevents revalidation requests, but while the cache is "fresh", any updates to the file are not reflected.
The other is a hacky one, requesting /<buildid>/<path> and transfering it to /public/<path> using rewirte or something. (or webpack??? hacky) This method works almost the same as this PR and no longer requires EquipmentImageList.ts. However, its implementation will be more complicated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As mentioned in #17, this pr replaces image paths with image imports. Imported images are included in the build result and appended a build-specific hash. The
Imagecomponent requests this hash-appended path and since the hash is build-specific, the responce is able to have longmax-ageand theimmutabledirective.However, since
EquipmentImageListexports large objects, the size of/increases by 25 kB as below.↓