I couldn't make it so that the BUILD_ID is exported at the top of the file since next will try to compile the file and throw an error because the file .next/BUILD_ID doesn't exist at build time. So to mitigate this, we replaced the cache function from next with our custom lifetimeCache function which caches the results of operations for the whole the server lifetime, this way the BUILD_ID isn't read at build time, but only read at runtime once.
Type of Change
[ ] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Description
This PR is in response to a suggestion bylubieowoce to make it so that we don't read the BUILD_ID on every request https://x.com/lubieowoce/status/1741255877108101466?s=20
I couldn't make it so that the BUILD_ID is exported at the top of the file since next will try to compile the file and throw an error because the file
.next/BUILD_ID
doesn't exist at build time. So to mitigate this, we replaced thecache
function from next with our customlifetimeCache
function which caches the results of operations for the whole the server lifetime, this way the BUILD_ID isn't read at build time, but only read at runtime once.Type of Change