WeSearch

Making Dynamic MDX Blogs Work with OpenNext on Cloudflare Workers

·6 min read · 0 reactions · 0 comments · 15 views
#mdx#opennext#cloudflare#nextjs#blog
Making Dynamic MDX Blogs Work with OpenNext on Cloudflare Workers
⚡ TL;DR · AI summary

The article discusses deploying a Next.js MDX blog to Cloudflare Workers using OpenNext. It highlights a common issue where the blog appears empty after deployment due to the way files are accessed. The author provides a solution by shifting file reading to build time instead of runtime, ensuring the blog functions correctly in the Cloudflare environment.

Key facts
Original article
DEV.to (Top)
Read full at DEV.to (Top) →
Opening excerpt (first ~120 words) tap to expand

try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 1170773) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } Harshal Ranjhani Posted on May 22 • Originally published at harshalranjhani.in Making Dynamic MDX Blogs Work with OpenNext on Cloudflare Workers #mdx #opennext #cloudflare #nextjs I ran into a small but annoying problem while deploying a Next.js MDX blog to Cloudflare Workers with OpenNext. The blog worked locally. The build passed. OpenNext even listed the blog routes during the build. Then I opened the deployed site, and the blog page was empty. The issue was not MDX.

Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).

Anonymous · no account needed
Share 𝕏 Facebook Reddit LinkedIn Threads WhatsApp Bluesky Mastodon Email

Discussion

0 comments

More from DEV.to (Top)