{"record":{"id":"4d2a1b6ff4e92a08","repo":"medusajs/medusa","slug":"layout-file-has-no-config-named-export-export","errorCode":null,"errorMessage":"Layout file has no 'config' named export. Export 'export const config = defineLayoutConfig(...)'.","messagePattern":"Layout file has no 'config' named export\\. Export 'export const config = defineLayoutConfig\\(\\.\\.\\.\\)'\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/admin/admin-vite-plugin/src/layouts/generate-layouts.ts","lineNumber":84,"sourceCode":"\n  let fileHasDefaultExport = false\n  try {\n    fileHasDefaultExport = await hasDefaultExport(ast)\n  } catch (e) {\n    logger.error(`An error occurred while checking for a default export.`, {\n      file,\n      error: e,\n    })\n    return null\n  }\n\n  if (!fileHasDefaultExport) {\n    logger.warn(`Layout file has no default export, skipping.`, { file })\n    return null\n  }\n\n  if (!hasConfigExport(ast)) {\n    logger.warn(\n      `Layout file has no 'config' named export. Export 'export const config = defineLayoutConfig(...)'.`,\n      { file }\n    )\n    return null\n  }\n\n  const componentName = `LayoutComponent${index}`\n  const configName = `LayoutConfig${index}`\n\n  return {\n    import: generateImport(file, componentName, configName),\n    componentName,\n    configName,\n  }\n}\n\n/**\n * Checks whether the file exports a `config` defined via `defineLayoutConfig(...)`.","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/admin/admin-vite-plugin/src/layouts/generate-layouts.ts#L66-L102","documentation":"Each admin layout file must export a config object named `config` created with defineLayoutConfig, which supplies the label, icon, and other metadata used to generate the layout registration. If the file has a default export but no `config` named export, the plugin skips it with this warning.","triggerScenarios":"A layout component file in src/admin/layouts with a default export but missing `export const config = defineLayoutConfig({...})`.","commonSituations":"New layout created by copying a plain component; the config export was deleted; config exported under a different name (e.g. `layoutConfig`).","solutions":["Add `export const config = defineLayoutConfig({ label: \"...\", ... })` to the layout file","Import defineLayoutConfig from @medusajs/admin-sdk","Restart the dev server"],"exampleFix":"// before\nexport default function MyLayout() { ... }\n\n// after\nimport { defineLayoutConfig } from \"@medusajs/admin-sdk\"\n\nexport const config = defineLayoutConfig({\n  label: \"My Layout\",\n})\n\nexport default function MyLayout() { ... }","handlingStrategy":"validation","validationCode":"// assert in a prebuild script\nconst src = readFileSync(f, \"utf8\")\nif (!/export\\s+const\\s+config\\s*=/.test(src)) throw new Error(`${f} missing config export`)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy the official layout template which includes defineLayoutConfig","Keep the config named exactly `config`"],"tags":["admin","layouts","config","named-export"],"backgroundTag":"missing-config-export","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}