medusajs/medusa · warning

'zone' property cannot be a template literal (e.g. `product.

Error message

'zone' property cannot be a template literal (e.g. `product.details.after`).

What it means

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.

Source

Thrown at packages/admin/admin-vite-plugin/src/widgets/generate-widgets.ts:323

    logger.warn(`'zone' property is missing from the widget config.`, { file })
    return null
  }

  const validatedZones = zones.filter(isValidInjectionZone)

  if (validatedZones.length === 0) {
    logger.warn(`'zone' property is not a valid injection zone.`, {
      file,
    })
    return null
  }

  return validatedZones
}

function extractZoneValues(value: Node, zones: string[], file: string) {
  if (isTemplateLiteral(value)) {
    logger.warn(
      `'zone' property cannot be a template literal (e.g. \`product.details.after\`).`,
      { file }
    )
    return
  }

  if (isStringLiteral(value)) {
    zones.push(value.value)
  } else if (isArrayExpression(value)) {
    const values = value.elements
      .filter((e) => isStringLiteral(e))
      .map((e) => e.value)
    zones.push(...values)
  } else {
    logger.warn(`'zone' property is not a string or array.`, { file })
    return
  }
}

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Replace backticks with single or double quotes in the zone value
  2. Ensure no interpolation in zone strings
  3. Restart the dev server

Example fix

// before
export const config = defineWidgetConfig({ zone: `product.details.after` })

// after
export const config = defineWidgetConfig({ zone: "product.details.after" })
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: zone: `product.details.after` (backticks) or an interpolated template literal in a widget config.

Common situations: Prettier converting single quotes to backticks via a rule; copy-paste from markdown docs where backticks wrapped the value.

Related errors


AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27). Data as JSON: /api/errors/27aa48ec900f0ea2. Report an issue: GitHub.