#Does fs.readFile support Incremental Static Regeneration?

1 messages · Page 1 of 1 (latest)

glacial totem
#

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.

Learn how to display and read the contents of a static json file in your Next.js application.

Learn how to create or update static pages at runtime with Incremental Static Regeneration.