if (Component.template && !Component.render) {
if (compile) {
Component.render = compile(Component.template, {
- onError(err) {}
+ onError(err) {
+ if (__DEV__) {
+ // TODO use err.loc to provide codeframe like Vue 2
+ warn(`Template compilation error: ${err.message}`)
+ }
+ }
})
} else if (__DEV__) {
warn(
// This package is the "full-build" that includes both the runtime
// and the compiler, and supports on-the-fly compilation of the template option.
import { compile, CompilerOptions } from '@vue/compiler-dom'
-import * as runtimeDom from '@vue/runtime-dom'
import { registerRuntimeCompiler, RenderFunction } from '@vue/runtime-dom'
+import * as runtimeDom from '@vue/runtime-dom'
function compileToFunction(
template: string,
hoistStatic: true,
...options
})
+
return new Function('Vue', code)(runtimeDom) as RenderFunction
}