Meituan-Dianping/mpvue · error

Invalid Component definition: ${String(Ctor)}

Error message

Invalid Component definition: ${String(Ctor)}

What it means

Emitted in createComponent after the Ctor passed to createElement cannot be turned into a constructor: a plain-object Ctor was converted via baseCtor.extend, but the result (or the original non-object Ctor) is still not a function — e.g. a component option resolved to undefined, a string, or an object that broke Vue.extend. This is a generic invalid-definition guard; the createComponent call aborts and returns undefined, so no vnode is created for that tag.

Source

Thrown at src/core/vdom/create-component.js:122

  children: ?Array<VNode>,
  tag?: string
): VNode | void {
  if (isUndef(Ctor)) {
    return
  }

  const baseCtor = context.$options._base

  // plain options object: turn it into a constructor
  if (isObject(Ctor)) {
    Ctor = baseCtor.extend(Ctor)
  }

  // if at this stage it's not a constructor or an async component factory,
  // reject.
  if (typeof Ctor !== 'function') {
    if (process.env.NODE_ENV !== 'production') {
      warn(`Invalid Component definition: ${String(Ctor)}`, context)
    }
    return
  }

  // async component
  let asyncFactory
  if (isUndef(Ctor.cid)) {
    asyncFactory = Ctor
    Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context)
    if (Ctor === undefined) {
      // return a placeholder node for async component, which is rendered
      // as a comment node but preserves all the raw information for the node.
      // the information will be used for async server-rendering and hydration.
      return createAsyncPlaceholder(
        asyncFactory,
        data,
        context,
        children,

View on GitHub (pinned to 6c5d78ee04)

Solutions

  1. Verify the component/directive value passed to createElement or the tag resolves to a constructor or options object — check imports return the component and not undefined
  2. Fix circular imports that make a component evaluate to undefined at render time
  3. If registering asynchronously, ensure the factory/Promise pattern for async components is used correctly
  4. Print or inspect the Ctor value in a debugger to see the actual faulty definition
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at src/core/vdom/create-component.js:122 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/c601369283392432. Report an issue: GitHub.