ChunkLoadError After Next.js Deploy Often Traced to CDN Caching Stale HTML
After a Next.js deployment, some visitors may see missing styles or broken interactivity alongside a ChunkLoadError for a JavaScript chunk that no longer exists. The article explains that Next.js uses content-hashed chunk filenames, and the HTML is the only place that records the current names, so cached HTML from before a deploy requests chunks that have been replaced. Caching of HTML can occur accidentally through a CDN rule, a reverse proxy, a hosting panel's cache toggle, or a service worker. Checking response headers such as cf-cache-status and Age can reveal which cache is serving the stale page. Each source requires a different fix, with service workers relevant only if one was deliberately added.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.



Discussion (0)
Log in to join the discussion and vote.
Log in