Usage of Date.now() causing issues with Next.js 16 CacheComponents
When rendering <Code> in a server component, with cacheComponents enabled, I get this error
Error: Route "/blog/[slug]" used
Date.now()before accessing either uncached data (e.g.fetch()) or Request data (e.g.cookies(),headers(),connection(), andsearchParams).Accessing the current time in a Server Component requires reading one of these data sources first. Alternatively, consider moving this expression into a Client Component or Cache Component. See more info here:
https://nextjs.org/docs/messages/next-prerender-current-time
It looks like the cache components mechanism is causing issues with the checks for performance.now and it is falling back to use Date.now
I've got a PR in place that will fix this. https://github.com/code-hike/lighter/pull/52
As a workaround, I've published @autovation/bright that has these changes in place