Meituan-Dianping/mpvue · error

Error compiling template:\n\n${template}\n\n${compiled.error

Error message

Error compiling template:\n\n${template}\n\n${compiled.errors.map(e => `- ${e}`).join('\n')}\n

What it means

Dev-mode warning from compileToFunctions in to-function.js: the runtime template compiler ran compile() on the template string and collected errors in compiled.errors. Vue logs the whole template plus an itemized error list; the resulting render function may be broken or missing, so this marks a template syntax/semantic failure at compile time, not runtime.

Source

Thrown at src/compiler/to-function.js:64

        }
      }
    }

    // check cache
    const key = options.delimiters
      ? String(options.delimiters) + template
      : template
    if (cache[key]) {
      return cache[key]
    }

    // compile
    const compiled = compile(template, options)

    // check compilation errors/tips
    if (process.env.NODE_ENV !== 'production') {
      if (compiled.errors && compiled.errors.length) {
        warn(
          `Error compiling template:\n\n${template}\n\n` +
          compiled.errors.map(e => `- ${e}`).join('\n') + '\n',
          vm
        )
      }
      if (compiled.tips && compiled.tips.length) {
        compiled.tips.forEach(msg => tip(msg, vm))
      }
    }

    // turn code into functions
    const res = {}
    const fnGenErrors = []
    res.render = createFunction(compiled.render, fnGenErrors)
    res.staticRenderFns = compiled.staticRenderFns.map(code => {
      return createFunction(code, fnGenErrors)
    })

View on GitHub (pinned to 6c5d78ee04)

Solutions

  1. Fix the template syntax errors listed after the template in the warning
  2. If the template comes from the DOM, check casing/closing-tag mangling by the HTML parser
  3. Move the component to an SFC with vue-loader to compile at build time where errors surface earlier
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/compiler/to-function.js:64 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/769ccb738d13017c. Report an issue: GitHub.