Skip to content

Commit 1a50110

Browse files
author
Guillaume Chau
committed
fix(ssr): missing ssr helpers, closes #378
1 parent 64505c6 commit 1a50110

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

ssr/consts.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
exports.VM_HELPERS = [
2-
'_ssrAttr',
3-
'_ssrNode',
4-
'_ssrEscape',
5-
'_ssrList',
62
'_o',
73
'_n',
84
'_s',
@@ -19,6 +15,17 @@ exports.VM_HELPERS = [
1915
'_g',
2016
]
2117

18+
exports.SSR_HELPERS = [
19+
'_ssrNode',
20+
'_ssrEscape',
21+
'_ssrList',
22+
'_ssrStyle',
23+
'_ssrClass',
24+
'_ssrAttr',
25+
'_ssrAttrs',
26+
'_ssrDOMProps',
27+
]
28+
2229
exports.COMPONENT_BLACKLIST = [
2330
'router-link',
2431
'router-view',

ssr/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
const chalk = require('chalk')
22
const { VUE_APOLLO_QUERY_KEYWORDS } = require('../lib/consts')
3-
const { VM_HELPERS, COMPONENT_BLACKLIST } = require('./consts')
3+
const { VM_HELPERS, SSR_HELPERS, COMPONENT_BLACKLIST } = require('./consts')
44
const { Globals, getMergedDefinition, omit, noop } = require('../lib/utils')
55

6+
function emptyString () {
7+
return ''
8+
}
9+
610
exports.install = function (Vue) {
711
Globals.Vue = Vue
812
}
@@ -76,7 +80,7 @@ function prefetchComponent (component, vm, queries) {
7680
key.charAt(0) !== '$' && (
7781
!options.query || (
7882
(typeof options.ssr === 'undefined' || options.ssr) &&
79-
(typeof options.prefetch !== 'undefined' && options.prefetch)
83+
options.prefetch !== false
8084
)
8185
)
8286
) {
@@ -115,6 +119,7 @@ function createFakeInstance (options, data, parent, children, context) {
115119

116120
// Render and other helpers
117121
VM_HELPERS.forEach(helper => vm[helper] = noop)
122+
SSR_HELPERS.forEach(helper => vm[helper] = emptyString)
118123

119124
// Scoped slots
120125
if (data.scopedSlots) {

0 commit comments

Comments
 (0)