Meituan-Dianping/mpvue · error · Error
render function or template not defined in component: ${
Error message
render function or template not defined in component: ${
vm.$options.name || vm.$options._componentTag || 'anonymous'
} What it means
Thrown by normalizeRender during SSR when a component instance reaching the server renderer has neither a compiled render function nor a template in its $options. It fires when a component was written without a render option and its template could not be precompiled at build time (e.g. vue-loader excluded the file, the component is defined via an object missing template/render, or runtime-only Vue is used where in-browser template compilation is unavailable).
Source
Thrown at src/server/render.js:36
} from 'core/vdom/create-component'
let warned = Object.create(null)
const warnOnce = msg => {
if (!warned[msg]) {
warned[msg] = true
console.warn(`\n\u001b[31m${msg}\u001b[39m\n`)
}
}
const normalizeRender = vm => {
const { render, template, _scopeId } = vm.$options
if (isUndef(render)) {
if (template) {
Object.assign(vm.$options, ssrCompileToFunctions(template, {
scopeId: _scopeId
}))
} else {
throw new Error(
`render function or template not defined in component: ${
vm.$options.name || vm.$options._componentTag || 'anonymous'
}`
)
}
}
}
function renderNode (node, isRoot, context) {
if (node.isString) {
renderStringNode(node, context)
} else if (isDef(node.componentOptions)) {
renderComponent(node, isRoot, context)
} else if (isDef(node.tag)) {
renderElement(node, isRoot, context)
} else if (isTrue(node.isComment)) {
if (isDef(node.asyncFactory)) {
// async componentView on GitHub (pinned to 6c5d78ee04)
Solutions
- Add a render function or a template to the component definition
- Ensure vue-loader processes the file so the template is compiled at build time
- If using runtime-only Vue, precompile all templates via SFCs or render functions
- Check the component name printed in the message to locate the offending component
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/server/render.js:36 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/7dbb87df3a529ee5.
Report an issue: GitHub.