Skip to content
This repository was archived by the owner on Dec 26, 2018. It is now read-only.

Commit 34830f9

Browse files
committed
more granular hot-reload
1 parent b26e25b commit 34830f9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/compiler.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ compiler.compile = function (content, filePath, cb) {
8181
.catch(cb)
8282

8383
function mergeParts () {
84-
// check whether each part has changed
84+
// check whether script/template has changed
8585
var prevParts = resolvedPartsCache[id] || {}
8686
resolvedPartsCache[id] = resolvedParts
8787
var scriptChanged = resolvedParts.script !== prevParts.script
@@ -133,7 +133,12 @@ compiler.compile = function (content, filePath, cb) {
133133
' hotAPI.createRecord("' + id + '", __vue__options__)\n' +
134134
' } else {\n' +
135135
// update
136-
' hotAPI.reload("' + id + '", __vue__options__)\n' +
136+
(scriptChanged
137+
? ' hotAPI.reload("' + id + '", __vue__options__)\n'
138+
: templateChanged
139+
? ' hotAPI.rerender("' + id + '", __vue__options__)\n'
140+
: ''
141+
) +
137142
' }\n' +
138143
'})()}'
139144
}

0 commit comments

Comments
 (0)