Meituan-Dianping/mpvue · error

Do not use built-in or reserved HTML elements as component i

Error message

Do not use built-in or reserved HTML elements as component id: ${key}

What it means

Emitted by checkComponents (a dev-only pass over options.components during option merging) when a locally registered component's id, lowercased, matches either isBuiltInTag (slot, component) or a platform reserved tag (config.isReservedTag — standard HTML elements like 'header', 'div', 'select'). Registering under such a name would make templates like <header> ambiguous between the native element and the custom component, so the name is rejected.

Source

Thrown at src/core/util/options.js:229

strats.provide = mergeDataOrFn

/**
 * Default strategy.
 */
const defaultStrat = function (parentVal: any, childVal: any): any {
  return childVal === undefined
    ? parentVal
    : childVal
}

/**
 * Validate component names
 */
function checkComponents (options: Object) {
  for (const key in options.components) {
    const lower = key.toLowerCase()
    if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
      warn(
        'Do not use built-in or reserved HTML elements as component ' +
        'id: ' + key
      )
    }
  }
}

/**
 * Ensure all props option syntax are normalized into the
 * Object-based format.
 */
function normalizeProps (options: Object) {
  const props = options.props
  if (!props) return
  const res = {}
  let i, val, name
  if (Array.isArray(props)) {
    i = props.length

View on GitHub (pinned to 6c5d78ee04)

Solutions

  1. Prefix the component id, e.g. register as 'my-header' or 'AppHeader' instead of 'header'
  2. Choose a name that is not an HTML element, <slot> or <component>
  3. If you intended to style/extend a native element, keep the native tag and apply classes or directives instead
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/util/options.js:229 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Meituan-Dianping/mpvue@6c5d78ee04 (2026-09-02). Data as JSON: /api/errors/3c141734998d4ef4. Report an issue: GitHub.