{"record":{"id":"21629d744672a8f4","repo":"facebook/docusaurus","slug":"the-page-component-at-path-doesn-t-have-a-defau","errorCode":null,"errorMessage":"The page component at ${path} doesn't have a default export. This makes it impossible to render anything. Consider default-exporting a React component.","messagePattern":"The page component at (.+?) doesn't have a default export\\. This makes it impossible to render anything\\. Consider default-exporting a React component\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/docusaurus/src/client/exports/ComponentCreator.tsx","lineNumber":92,"sourceCode":"      // restore the chunk names' previous shape from this flat record.\n      // We do so by taking advantage of the existing `chunkNames` and replacing\n      // each chunk name with its loaded module, so we don't create another\n      // object from scratch.\n      const loadedModules = JSON.parse(JSON.stringify(chunkNames)) as {\n        __comp?: React.ComponentType<object>;\n        __context?: RouteContext;\n        __props?: {[propName: string]: unknown};\n        [attributeName: string]: unknown;\n      };\n      Object.entries(loaded).forEach(([keyPath, loadedModule]) => {\n        // JSON modules are also loaded as `{ default: ... }` (`import()`\n        // semantics) but we just want to pass the actual value to props.\n        const chunk = loadedModule.default;\n        // One loaded chunk can only be one of two things: a module (props) or a\n        // component. Modules are always JSON, so `default` always exists. This\n        // could only happen with a user-defined component.\n        if (!chunk) {\n          throw new Error(\n            `The page component at ${path} doesn't have a default export. This makes it impossible to render anything. Consider default-exporting a React component.`,\n          );\n        }\n        // A module can be a primitive, for example, if the user stored a string\n        // as a prop. However, there seems to be a bug with swc-loader's CJS\n        // logic, in that it would load a JSON module with content \"foo\" as\n        // `{ default: \"foo\", 0: \"f\", 1: \"o\", 2: \"o\" }`. Just to be safe, we\n        // first make sure that the chunk is non-primitive.\n        if (typeof chunk === 'object' || typeof chunk === 'function') {\n          Object.keys(loadedModule)\n            .filter((k) => k !== 'default')\n            .forEach((nonDefaultKey) => {\n              (chunk as {[key: string]: unknown})[nonDefaultKey] =\n                loadedModule[nonDefaultKey];\n            });\n        }\n        // We now have this chunk prepared. Go down the key path and replace the\n        // chunk name with the actual chunk.","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus/src/client/exports/ComponentCreator.tsx#L74-L110","documentation":"ComponentCreator renders each route by reading the default export of the loaded module (loadedModule.default). If default is falsy it throws 'The page component at ${path} doesn't have a default export', because there is nothing to render. This almost always means the page file lacks `export default` or the route's __comp points at a module that is not a React component.","triggerScenarios":"A file in src/pages/ with only named exports; a plugin route whose component module has no default export; a re-export file like `export {Foo}` without `export default`; the route config __comp string resolving to a JSON/util module.","commonSituations":"Forgetting `export default` on a new page; using `export function Page()` and never adding the default; broken index/barrel re-export; HOC/memo wrapping that returns undefined; build caching an old version of a freshly edited page (run `docusaurus clear`).","solutions":["Open the file at the reported path and add `export default YourComponent`.","If the module re-exports, add `export { default } from './Page'` or `export { Foo as default }`.","Verify the route config (addRoute/plugin) points __comp at a component module, not a data/util module.","Run `docusaurus clear` to drop stale build cache, then rebuild."],"exampleFix":"// before (src/pages/help.tsx)\nexport function Help() {\n  return <h1>Help</h1>;\n}\n// after\nexport default function Help() {\n  return <h1>Help</h1>;\n}","handlingStrategy":"validation","validationCode":"import assert from 'node:assert';\n\nasync function checkPageDefaultExport(path: string) {\n  const mod = await import(path);\n  assert.ok(\n    mod.default,\n    `Page at ${path} has no default export; cannot render`,\n  );\n}","typeGuard":"const hasDefaultExport = <T>(\n  mod: T,\n): mod is T & {default: React.ComponentType} =>\n  Boolean((mod as {default?: unknown}).default);","tryCatchPattern":null,"preventionTips":["Always `export default` the page component in src/pages.","In barrel re-exports, include `export { default } from './Page'`.","Run `docusaurus clear` after structural page changes to avoid stale build cache."],"tags":["routing","build","react","pages"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}