File tree 3 files changed +9
-8
lines changed
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 (
84
84
? [ ] . concat ( existing , hook )
85
85
: [ hook ]
86
86
} 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
87
90
// register for functioal component in vue file
88
91
options . render = function renderWithStyleInjection ( h , context ) {
89
92
hook . call ( context )
Original file line number Diff line number Diff line change @@ -386,17 +386,13 @@ module.exports = function (content) {
386
386
output +=
387
387
'\n/* hot reload */\n' +
388
388
'if (module.hot) {(function () {\n' +
389
- ' var hotAPI = require("' +
390
- hotReloadAPIPath +
391
- '")\n' +
389
+ ' var hotAPI = require("' + hotReloadAPIPath + '")\n' +
392
390
' hotAPI.install(require("vue"), false)\n' +
393
391
' if (!hotAPI.compatible) return\n' +
394
392
' module.hot.accept()\n' +
395
393
' if (!module.hot.data) {\n' +
396
394
// initial insert
397
- ' hotAPI.createRecord("' +
398
- moduleId +
399
- '", Component.options)\n' +
395
+ ' hotAPI.createRecord("' + moduleId + '", Component.options)\n' +
400
396
' } else {\n'
401
397
// update
402
398
if ( cssModules ) {
@@ -406,7 +402,9 @@ module.exports = function (content) {
406
402
' }\n'
407
403
}
408
404
output +=
409
- ' hotAPI.reload("' + moduleId + '", Component.options)\n' + ' }\n'
405
+ ` hotAPI.${
406
+ functionalTemplate ? 'rerender' : 'reload'
407
+ } ("${ moduleId } ", Component.options)\n' + ' }\n`
410
408
// dispose
411
409
output +=
412
410
' module.hot.dispose(function (data) {\n' +
Original file line number Diff line number Diff line change 51
51
"prettier" : " ^1.7.0" ,
52
52
"resolve" : " ^1.4.0" ,
53
53
"source-map" : " ^0.6.1" ,
54
- "vue-hot-reload-api" : " ^2.1 .0" ,
54
+ "vue-hot-reload-api" : " ^2.2 .0" ,
55
55
"vue-style-loader" : " ^3.0.0" ,
56
56
"vue-template-es2015-compiler" : " ^1.6.0"
57
57
},
You can’t perform that action at this time.
0 commit comments