Improve compile time on dev for huge vaults/content folders #330
Unanswered
olayway
asked this question in
General and Help
Replies: 1 comment 5 replies
-
Good point to raise. Think would be useful to get more evidence that this is an issue for people. Also could to consider multiple options for improving performance here - e.g. maybe turbo will help a lot etc. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
From Next.js docs:
In Flowershow, in order to support any user's content folder (vault) structure, we only have a single catch-all
[[...slug]].jsx
page, which creates a list of paths to the user's files in itsgetStaticPaths
by taking ALL the documents generated by Contentlayer and using their URL paths.Because of that, the more files in the user's vault the slower the initial compilation time, as Next.js will pre-render all the pages returned by
getStaticPaths
.If the
/pages
folder reflected the content folder structure, with each folder having its own[[...slug]].jsx
file, this time would be split, i.e. when requestinglocalhost:3000/
only the files in the root folder would be pre-rendered, then, when requesting e.g.localhost:3000/docs/some-tutorial-page
, only the files insidedocs
folder would be pre-rendered etc. The issue would persist though if the user had a flat folder structure, i.e. there were no subdirectories in the content folder.This could probably be achieved with some script.
Beta Was this translation helpful? Give feedback.
All reactions