-
Notifications
You must be signed in to change notification settings - Fork 27.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: Add note about Favicon Caching in Vercel #65755
Conversation
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reproduction for this issue? So you are saying the file itself has changed, but it still cached?
Yes, I replicated it here using create-next-app: When favicon.ico is deleted the Vercel deployment correctly has no favicon, but when a new favicon.ico is added, the old Vercel favicon re-appears. There is more discussion here: |
@columk1 I actually came across this issue myself! We should instead look to fix this issue instead of adding it as the expected behavior. We are taking a look! |
Current thinking is that this is a Next.js bug not a Vercel bug. You should encounter the same problem on any hosting provider with a build cache. |
Okay, that makes more sense. Thank you. |
### What Use `addDependency` to track the file path passed to `next-metadata-route-loader` NOTE: We cannot apply the `next-metadata-route-loader` directly to the metatda convention source files, since the json file could be processed by json loader (Related previous fix #62615) ### Why Previously when we passed down the file path as argument to the loader, which sort of breaking the caching of webpack as the actual resource path is string, it's not tracked as a dependency. This change fixed the bad caching issue of static metadata routes. Based on the above reason we use `addDependency` here to track the dependency change Closes NEXT-3521 Closes #65755
Use `addDependency` to track the file path passed to `next-metadata-route-loader` NOTE: We cannot apply the `next-metadata-route-loader` directly to the metatda convention source files, since the json file could be processed by json loader (Related previous fix #62615) Previously when we passed down the file path as argument to the loader, which sort of breaking the caching of webpack as the actual resource path is string, it's not tracked as a dependency. This change fixed the bad caching issue of static metadata routes. Based on the above reason we use `addDependency` here to track the dependency change Closes NEXT-3521 Closes #65755
Use `addDependency` to track the file path passed to `next-metadata-route-loader` NOTE: We cannot apply the `next-metadata-route-loader` directly to the metatda convention source files, since the json file could be processed by json loader (Related previous fix #62615) Previously when we passed down the file path as argument to the loader, which sort of breaking the caching of webpack as the actual resource path is string, it's not tracked as a dependency. This change fixed the bad caching issue of static metadata routes. Based on the above reason we use `addDependency` here to track the dependency change Closes NEXT-3521 Closes #65755
What?
This PR adds a note to inform users of Vercel's build cache, which makes it difficult to replace favicon files once deployed.
Why?
There are many posts about issues replacing favicons on Stack Overflow, Reddit, Github etc. Many solutions involve renaming favicon.ico in the app folder to icon.ico, which works well but it's not clear why from what is said in the docs.
The docs don't mention that Vercel caches the favicon in the build cache and will not replace the file unless the build cache is invalidated or a different file is pointed to in the metadata.
Using any of the cache invalidation options at the link below will allow a favicon file to be updated after it has been deployed.
https://vercel.com/docs/deployments/troubleshoot-a-build#managing-build-cache