Skip to content

Commit f4a575a

Browse files
author
Guillaume Chau
committed
Merge branch 'hmr-fix'
2 parents 47188fc + 734b53a commit f4a575a

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

packages/vue-component-dev-client/client/vue2-hot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ exports.reload = tryWrap((id, options) => {
201201
// preserve pre 2.2 behavior for global mixin handling
202202
record.Ctor.extendOptions = options
203203
}
204-
const newCtor = record.Ctor.super.extend(options)
204+
const newCtor = (record.Ctor.super || record.Ctor).extend(options)
205205
record.Ctor.options = newCtor.options
206206
record.Ctor.cid = newCtor.cid
207207
record.Ctor.prototype = newCtor.prototype

packages/vue-component/plugin/tag-handler.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ VueComponentTagHandler = class VueComponentTagHandler {
114114
}
115115

116116
// Export
117-
script += `\nreturn require('${this.inputFile.getDisplayPath()}').default`
118117

119118
// Babel
120119
if (useBabel) {
@@ -180,7 +179,7 @@ VueComponentTagHandler = class VueComponentTagHandler {
180179
map.names = lastMap.names
181180
map.file = this.inputFile.getPathInPackage()
182181

183-
js += '__vue_script__ = (function(){ ' + script + '\n})()'
182+
js += 'module.exportDefault = function(value) { __vue_script__ = value; }; (function(){ if (!module.watch) {console.log(\'module\', module);} ' + script + '\n})();'
184183
}
185184

186185
// Template

packages/vue-component/plugin/vue-compiler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ class ComponentWatcher {
342342
this.refresh()
343343
}
344344
}, 100, {
345-
leading: true,
346-
trailing: false,
345+
leading: false,
346+
trailing: true,
347347
}))
348348
this.watcher.on('error', (error) => console.error(error))
349349
}

0 commit comments

Comments
 (0)