nextjs - 💡(How to fix) Fix Blank pages on module export, error 404 Failed to load _next/statis/chunks [4 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#86983Fetched 2026-04-08 02:08:07
View on GitHub
Comments
4
Participants
3
Timeline
10
Reactions
0
Author
Timeline (top)
commented ×4subscribed ×2issue_type_added ×1labeled ×1

Code Example

const { version } = require("../../package.json");
/** @type {import('next').NextConfig} */

const nextConfig = {
  trailingSlash: true,
  env: {
    NEXT_PUBLIC_APP_VERSION: version,
  },
  reactStrictMode: true,
  webpack: (config, { dev, isServer, webpack }) => {
    if (!isServer) {
      config.output.chunkFilename = dev
        ? "static/chunks/[name]-[hash].js"
        : "static/chunks/[name]-[contenthash].js";
    }

    return config;
  },
  transpilePackages: ["@monorepo/ui"],
  output: "export",
  distDir: ".next",
  images: {
    unoptimized: true,
  },
  eslint: { ignoreDuringBuilds: true },
  typescript: { ignoreBuildErrors: true },
};
module.exports = nextConfig;

localhost, production - any machine it runs on
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/majkel572/blank-page-reprod

To Reproduce

Unfortunately, this is irreproducible. With settup presented below I can get on ANY page, in ANY time the blank page with 404, Failed to load _next/static/chunks/...c7fd35c123321.js:1 resource: the server responded with a status of 404 ()

As I mentioned, yesterday it worked, today /page1 collapsed, 2 days ago /page2 collapsed. After 20 refreshes it is somehow repaired. I mean soft and hard refreshes.

Current vs. Expected behavior

Page loading correctlt vs Blank page on random day at random time

Provide environment information

const { version } = require("../../package.json");
/** @type {import('next').NextConfig} */

const nextConfig = {
  trailingSlash: true,
  env: {
    NEXT_PUBLIC_APP_VERSION: version,
  },
  reactStrictMode: true,
  webpack: (config, { dev, isServer, webpack }) => {
    if (!isServer) {
      config.output.chunkFilename = dev
        ? "static/chunks/[name]-[hash].js"
        : "static/chunks/[name]-[contenthash].js";
    }

    return config;
  },
  transpilePackages: ["@monorepo/ui"],
  output: "export",
  distDir: ".next",
  images: {
    unoptimized: true,
  },
  eslint: { ignoreDuringBuilds: true },
  typescript: { ignoreBuildErrors: true },
};
module.exports = nextConfig;

localhost, production - any machine it runs on

Which area(s) are affected? (Select all that apply)

Not Found

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Other (Deployed)

Additional context

Any browser, any setup.

extent analysis

TL;DR

The issue can be mitigated by adjusting the webpack configuration to ensure consistent chunk filenames across different environments.

Guidance

  • Verify that the chunkFilename configuration is correctly applied in both development and production environments to prevent discrepancies in chunk filenames.
  • Check the nextConfig object for any other settings that might be causing the issue, such as output or distDir.
  • Consider setting output.chunkFilename to a consistent value, regardless of the environment, to prevent filename mismatches.
  • Investigate the transpilePackages option and its potential impact on chunk generation.

Example

webpack: (config, { dev, isServer, webpack }) => {
  config.output.chunkFilename = "static/chunks/[name]-[contenthash].js";
  return config;
},

Notes

The provided nextConfig object seems to be using a mix of development and production settings, which might be causing the issue. The webpack configuration is only applied when !isServer, which could lead to inconsistencies between environments.

Recommendation

Apply workaround: Adjust the webpack configuration to use a consistent chunkFilename across environments, as shown in the example above. This should help mitigate the issue, but further investigation may be necessary to identify the root cause.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix Blank pages on module export, error 404 Failed to load _next/statis/chunks [4 comments, 3 participants]