Skip to content

Commit 64b3d13

Browse files
committed
mark render functions with _withStripped in dev mode
1 parent 2903828 commit 64b3d13

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/template-compiler.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function rewrite (attr, name) {
4747

4848
module.exports = function (html) {
4949
this.cacheable()
50+
var isProduction = this.minimize || process.env.NODE_ENV === 'production'
5051
var query = loaderUtils.parseQuery(this.query)
5152
var isServer = this.options.target === 'node'
5253
var vueOptions = this.options.__vueOptions__
@@ -68,10 +69,19 @@ module.exports = function (html) {
6869
})
6970
code = 'module.exports={render:function(){},staticRenderFns:[]}'
7071
} else {
72+
var bubleOptions = vueOptions.buble
7173
code = transpile('module.exports={' +
7274
'render:' + toFunction(compiled.render) + ',' +
7375
'staticRenderFns: [' + compiled.staticRenderFns.map(toFunction).join(',') + ']' +
74-
'}', vueOptions.buble)
76+
'}', bubleOptions)
77+
// mark with stripped (this enables Vue to use correct runtime proxy detection)
78+
if (!isProduction && (
79+
!bubleOptions ||
80+
!bubleOptions.transforms ||
81+
bubleOptions.transforms.stripWith !== false
82+
)) {
83+
code += `\nmodule.exports.render._withStripped = true`
84+
}
7585
}
7686
// hot-reload
7787
if (!isServer &&

0 commit comments

Comments
 (0)