question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not build more than 101 pages with Next.js

See original GitHub issue

What 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

  1. git clone https://github.com/markdoc/markdoc-starter
  2. 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}`);
}
  1. npm run build
  2. It will stuck on info - Creating an optimized production build ... forever.
  3. Delete one markdown file from pages/docs/, and it will build successfully.
  4. And then, without deleting .next folder, add some more markdown files to pages/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:closed
  • Created a year ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
mfix-stripecommented, Oct 21, 2022

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 in CI), you should call Markdoc.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.

1reaction
faustbriancommented, Oct 16, 2022

You mean ulimit? Not aware of a command called limits.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found