vercel/next.js · error

[React Refresh] Failed to get exports for module: ${moduleId

Error message

[React Refresh] Failed to get exports for module: ${moduleId}.

What it means

RspackReactRefresh's getModuleExports warns when the webpack/rspack module cache has no entry for moduleId (runtime or dynamically generated modules), meaning exports cannot be captured for Fast Refresh; it returns an empty object so registration continues safely.

Source

Thrown at packages/react-refresh-utils/internal/RspackReactRefresh.ts:22

  c: Record<string | number, { exports: unknown | (() => Promise<unknown>) }>
}

// Extracts exports from a webpack module object.
function getModuleExports(moduleId: string) {
  if (typeof moduleId === 'undefined') {
    // `moduleId` is unavailable, which indicates that this module is not in the cache,
    // which means we won't be able to capture any exports,
    // and thus they cannot be refreshed safely.
    // These are likely runtime or dynamically generated modules.
    return {}
  }

  var maybeModule = __webpack_require__.c[moduleId]
  if (typeof maybeModule === 'undefined') {
    // `moduleId` is available but the module in cache is unavailable,
    // which indicates the module is somehow corrupted (e.g. broken Webpack `module` globals).
    // We will warn the user (as this is likely a mistake) and assume they cannot be refreshed.
    console.warn(
      '[React Refresh] Failed to get exports for module: ' + moduleId + '.'
    )
    return {}
  }

  var exportsOrPromise = maybeModule.exports
  if (typeof Promise !== 'undefined' && exportsOrPromise instanceof Promise) {
    return exportsOrPromise.then(function (exports) {
      return exports
    })
  }
  return exportsOrPromise
}

function executeRuntime(moduleExports, moduleId, webpackHot) {
  RefreshHelpers.registerExportsForReactRefresh(moduleExports, moduleId)

  if (webpackHot) {

View on GitHub (pinned to 0eb3775416)

Solutions

  1. Reload the page; React Refresh could not read the module exports, usually from a transient HMR state.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/react-refresh-utils/internal/RspackReactRefresh.ts:22 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19). Data as JSON: /api/errors/f14db4379af979db. Report an issue: GitHub.