{"record":{"id":"5aba525c26f65b28","repo":"Meituan-Dianping/mpvue","slug":"invalid-component-definition-string-ctor","errorCode":null,"errorMessage":"Invalid Component definition: ${String(Ctor)}","messagePattern":"Invalid Component definition: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/weex-vue-framework/factory.js","lineNumber":3548,"sourceCode":"  children,\n  tag\n) {\n  if (isUndef(Ctor)) {\n    return\n  }\n\n  var baseCtor = context.$options._base;\n\n  // plain options object: turn it into a constructor\n  if (isObject(Ctor)) {\n    Ctor = baseCtor.extend(Ctor);\n  }\n\n  // if at this stage it's not a constructor or an async component factory,\n  // reject.\n  if (typeof Ctor !== 'function') {\n    if (process.env.NODE_ENV !== 'production') {\n      warn((\"Invalid Component definition: \" + (String(Ctor))), context);\n    }\n    return\n  }\n\n  // async component\n  var asyncFactory;\n  if (isUndef(Ctor.cid)) {\n    asyncFactory = Ctor;\n    Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);\n    if (Ctor === undefined) {\n      // return a placeholder node for async component, which is rendered\n      // as a comment node but preserves all the raw information for the node.\n      // the information will be used for async server-rendering and hydration.\n      return createAsyncPlaceholder(\n        asyncFactory,\n        data,\n        context,\n        children,","sourceCodeStart":3530,"sourceCodeEnd":3566,"githubUrl":"https://github.com/Meituan-Dianping/mpvue/blob/6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b/packages/weex-vue-framework/factory.js#L3530-L3566","documentation":"During vnode creation, after resolving aliases and `asyncComponent` handling, Vue requires the component option to be a constructor function or an async component factory. If `Ctor` is still not a function, Vue warns with the stringified value and aborts rendering that component.","triggerScenarios":"Passing a component definition object where a registered/constructor component is expected (e.g. `components: { x: { ... } }` but referencing it with `:is=\"someObject\"` incorrectly), `Vue.component('x', undefined)` then using `<x/>`, a failed default/named import (`import X from 'lib'` where lib has no default, so X is undefined), or passing a string name never registered via `components`.","commonSituations":"Typo in component registration vs. usage; circular imports yielding `undefined` at module-eval time; mixing Vue 2 object-syntax components into `:is` bindings; dynamic `resolveComponent` on an unregistered tag.","solutions":["Log `String(Ctor)`/the variable to see what was actually passed (usually `undefined`), then fix the import/registration.","Register the component: `components: { myComp }` locally or `Vue.component('my-comp', MyComp)` globally.","For dynamic components, pass a real options object to `:is` only with `Vue.extend(obj)` or ensure it resolves via `resolveComponent`.","Check circular imports and import timing; use `defineAsyncComponent`/`() => import(...)` for async loading."],"exampleFix":"// before\nimport Comp from 'my-lib'; // no default export -> undefined\ncomponents: { Comp }\n// after\nimport { Comp } from 'my-lib';\ncomponents: { Comp }","handlingStrategy":"type-guard","validationCode":"if (typeof MyComp !== 'function') {\n  throw new TypeError(`Invalid component: ${String(MyComp)} — check import/registration`);\n}","typeGuard":"function isValidComponent(Ctor) {\n  return typeof Ctor === 'function' || (Ctor && typeof Ctor.render === 'function' && Ctor.cid);\n}","tryCatchPattern":null,"preventionTips":["Verify imports resolve (named vs default) before registering.","Keep a components index file to avoid circular-import undefineds.","Type dynamic `:is` values as `Component` and validate at runtime in dev."],"tags":["vue","component-registration","render","dev-warning"],"backgroundTag":"invalid-component-definition","analyzedSha":"6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b","analyzedAt":"2026-09-02T05:17:40.946Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}