Skip to content

Commit 7c3db41

Browse files
committed
warn undefined render/template during SSR
1 parent 5c55dec commit 7c3db41

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/server/render.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,20 @@ const normalizeAsync = (cache, method) => {
1818
const compilationCache = Object.create(null)
1919
const normalizeRender = vm => {
2020
const { render, template } = vm.$options
21-
if (!render && template) {
22-
const renderFns = (
23-
compilationCache[template] ||
24-
(compilationCache[template] = compileToFunctions(template))
25-
)
26-
Object.assign(vm.$options, renderFns)
21+
if (!render) {
22+
if (template) {
23+
const renderFns = (
24+
compilationCache[template] ||
25+
(compilationCache[template] = compileToFunctions(template))
26+
)
27+
Object.assign(vm.$options, renderFns)
28+
} else {
29+
throw new Error(
30+
`render function or template not defined in component: ${
31+
vm.$options.name || vm.$options._componentTag || 'anonymous'
32+
}`
33+
)
34+
}
2735
}
2836
}
2937

0 commit comments

Comments
 (0)