Can not build more than 101 pages with Next.js
See original GitHub issueWhat happened?
I clone markdoc’s Next.js starter demo, randomly add 97 markdom files to pages/docs/
folder, then run npm run build
, and Next.js will stuck on info - Creating an optimized production build ...
forever.
To reproduce
git clone https://github.com/markdoc/markdoc-starter
- Add random markdown files to
pages/docs/
folder like below:
const fs = require("fs");
for (let i = 0; i < 98; i++) {
fs.writeFileSync(`./pages/docs/${i}.md`, `##${i}`);
}
npm run build
- It will stuck on
info - Creating an optimized production build ...
forever. - Delete one markdown file from
pages/docs/
, and it will build successfully. - And then, without deleting
.next
folder, add some more markdown files topages/docs/
, will build successfully. But if you delete.next
before adding more files, it will hang forever.
I try to refactor my blog using markdoc, then found this issue. Had tried several next versions and markdoc versions, no luck. I think it’s more likely markdoc related? Looking for help, thanks!
Version
try latest and older versions
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Forever stuck on Creating an optimized production build in ...
I verified that the issue exists in the latest Next.js canary release ... Can not build more than 101 pages with Next.js markdoc/markdoc#250....
Read more >Basic Features: Pages - Next.js
Statically generated pages can be cached by CDN with no extra configuration to boost performance.
Read more >Next.js development 101 - Ikius
Next.js is a robust framework that allows you to build scalable web apps easily, but one feature in particular can cut development times...
Read more >A Complete Beginner's Guide to Next.js - We Learn Code
We want to build a page for each of our colors following the same format but without having to hardcode each page. First,...
Read more >Next.js 101 - More learning resources - YouTube
What did you like the most about this Next. js 101 series? Let me know in the comments.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey folks, sorry for the delay here. I dug into this deeper, and there is something weird going on within Webpack and/or Next.js that prevents us from importing a module more than a certain amount of times at once. The trouble is we don’t know that number ahead of time, nor are we able to stop if from hanging forever without introducing even worse behavior.
I fixed this issue here (https://github.com/markdoc/next.js/pull/19) by removing the build-time
importModule
call, which disables the Markdoc validation support we had previously included. If you want to validate all your content (for example inCI
), you should callMarkdoc.validate
in a separate script.I will release this fix on Monday.
Full validation was never supported in
@markdoc/next.js
so this shouldn’t break any applications.As a follow up, I will open an issue that re-thinks build time schema validation for the Markdoc Nexts.js plugin.
You mean
ulimit
? Not aware of a command calledlimits
.