Meituan-Dianping/mpvue · error
Templates should only be responsible for mapping the state t
Error message
Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <${tag}>, as they will not be parsed. What it means
Error "Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <${tag}>, as they will not be parsed." thrown in Meituan-Dianping/mpvue.
Source
Thrown at src/compiler/parser/index.js:119
if (isIE && ns === 'svg') {
attrs = guardIESVGBug(attrs)
}
const element: ASTElement = {
type: 1,
tag,
attrsList: attrs,
attrsMap: makeAttrsMap(attrs),
parent: currentParent,
children: []
}
if (ns) {
element.ns = ns
}
if (isForbiddenTag(element) && !isServerRendering()) {
element.forbidden = true
process.env.NODE_ENV !== 'production' && warn(
'Templates should only be responsible for mapping the state to the ' +
'UI. Avoid placing tags with side-effects in your templates, such as ' +
`<${tag}>` + ', as they will not be parsed.'
)
}
// apply pre-transforms
for (let i = 0; i < preTransforms.length; i++) {
preTransforms[i](element, options)
}
if (!inVPre) {
processPre(element)
if (element.pre) {
inVPre = true
}
}
if (platformIsPreTag(element.tag)) {View on GitHub (pinned to 6c5d78ee04)
Solutions
- Move side-effectful tags (<script>, <style> in restricted contexts) out of the template into the page or build pipeline
- Use components/lifecycle hooks to trigger effects instead of template tags
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/compiler/parser/index.js:119 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/e45b46281012c985.
Report an issue: GitHub.