{"record":{"id":"27aa48ec900f0ea2","repo":"medusajs/medusa","slug":"zone-property-cannot-be-a-template-literal-e-g","errorCode":null,"errorMessage":"'zone' property cannot be a template literal (e.g. `product.details.after`).","messagePattern":"'zone' property cannot be a template literal \\(e\\.g\\. `product\\.details\\.after`\\)\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/admin/admin-vite-plugin/src/widgets/generate-widgets.ts","lineNumber":323,"sourceCode":"    logger.warn(`'zone' property is missing from the widget config.`, { file })\n    return null\n  }\n\n  const validatedZones = zones.filter(isValidInjectionZone)\n\n  if (validatedZones.length === 0) {\n    logger.warn(`'zone' property is not a valid injection zone.`, {\n      file,\n    })\n    return null\n  }\n\n  return validatedZones\n}\n\nfunction extractZoneValues(value: Node, zones: string[], file: string) {\n  if (isTemplateLiteral(value)) {\n    logger.warn(\n      `'zone' property cannot be a template literal (e.g. \\`product.details.after\\`).`,\n      { file }\n    )\n    return\n  }\n\n  if (isStringLiteral(value)) {\n    zones.push(value.value)\n  } else if (isArrayExpression(value)) {\n    const values = value.elements\n      .filter((e) => isStringLiteral(e))\n      .map((e) => e.value)\n    zones.push(...values)\n  } else {\n    logger.warn(`'zone' property is not a string or array.`, { file })\n    return\n  }\n}","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/admin/admin-vite-plugin/src/widgets/generate-widgets.ts#L305-L341","documentation":"Zone values must be plain string literals so the plugin can statically map widgets to injection zones. Template literals cannot be statically evaluated during code generation, so extractZoneValues warns and ignores the value.","triggerScenarios":"zone: `product.details.after` (backticks) or an interpolated template literal in a widget config.","commonSituations":"Prettier converting single quotes to backticks via a rule; copy-paste from markdown docs where backticks wrapped the value.","solutions":["Replace backticks with single or double quotes in the zone value","Ensure no interpolation in zone strings","Restart the dev server"],"exampleFix":"// before\nexport const config = defineWidgetConfig({ zone: `product.details.after` })\n\n// after\nexport const config = defineWidgetConfig({ zone: \"product.details.after\" })","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use single or double quotes for zone strings; never backticks","Add a lint rule banning template literals in src/admin config files"],"tags":["admin","widgets","template-literal","static-analysis"],"backgroundTag":"build-time-static-analysis","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}