File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,9 @@ module.exports = function normalizeComponent (
8484 ? [ ] . concat ( existing , hook )
8585 : [ hook ]
8686 } else {
87+ // for template-only hot-reload because in that case the render fn doesn't
88+ // go through the normalizer
89+ options . _injectStyles = hook
8790 // register for functioal component in vue file
8891 options . render = function renderWithStyleInjection ( h , context ) {
8992 hook . call ( context )
Original file line number Diff line number Diff line change @@ -386,17 +386,13 @@ module.exports = function (content) {
386386 output +=
387387 '\n/* hot reload */\n' +
388388 'if (module.hot) {(function () {\n' +
389- ' var hotAPI = require("' +
390- hotReloadAPIPath +
391- '")\n' +
389+ ' var hotAPI = require("' + hotReloadAPIPath + '")\n' +
392390 ' hotAPI.install(require("vue"), false)\n' +
393391 ' if (!hotAPI.compatible) return\n' +
394392 ' module.hot.accept()\n' +
395393 ' if (!module.hot.data) {\n' +
396394 // initial insert
397- ' hotAPI.createRecord("' +
398- moduleId +
399- '", Component.options)\n' +
395+ ' hotAPI.createRecord("' + moduleId + '", Component.options)\n' +
400396 ' } else {\n'
401397 // update
402398 if ( cssModules ) {
@@ -406,7 +402,9 @@ module.exports = function (content) {
406402 ' }\n'
407403 }
408404 output +=
409- ' hotAPI.reload("' + moduleId + '", Component.options)\n' + ' }\n'
405+ ` hotAPI.${
406+ functionalTemplate ? 'rerender' : 'reload'
407+ } ("${ moduleId } ", Component.options)\n' + ' }\n`
410408 // dispose
411409 output +=
412410 ' module.hot.dispose(function (data) {\n' +
Original file line number Diff line number Diff line change 5151 "prettier" : " ^1.7.0" ,
5252 "resolve" : " ^1.4.0" ,
5353 "source-map" : " ^0.6.1" ,
54- "vue-hot-reload-api" : " ^2.1 .0" ,
54+ "vue-hot-reload-api" : " ^2.2 .0" ,
5555 "vue-style-loader" : " ^3.0.0" ,
5656 "vue-template-es2015-compiler" : " ^1.6.0"
5757 },
You can’t perform that action at this time.
0 commit comments