Next.js Discord

Discord Forum

Does fs.readFile support Incremental Static Regeneration?

Unanswered
Atlantic mackerel posted this in #help-forum
Open in Discord
Atlantic mackerelOP
https://vercel.com/guides/loading-static-file-nextjs-api-route

https://nextjs.org/docs/pages/building-your-application/data-fetching/incremental-static-regeneration

I use fs.readFile to read the local source code file, and then use shiki to perform code highlighting. When encountering an extra-long file with nearly 40,000 lines, each rendering process requires about 10 seconds. Therefore, I speculate that fs.readFile is not cached, causing shiki to be executed repeatedly.

0 Replies