Skip to content

Commit 1e520c6

Browse files
committed
support modules that export already extended contructors
1 parent 64d5bb6 commit 1e520c6

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/loader.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,17 @@ module.exports = function (content) {
105105
output += getRequire('style', style, i, style.scoped)
106106
})
107107

108-
// only one script tag allowed
108+
// add require for script
109109
if (parts.script.length) {
110110
output += 'module.exports = ' +
111111
getRequire('script', parts.script[0], 0)
112112
}
113113

114-
// only one template tag allowed
114+
// add require for template
115115
if (parts.template.length) {
116-
output += 'module.exports.template = ' +
116+
output += ';(typeof module.exports === "function" ' +
117+
'? module.exports.options ' +
118+
': module.exports).template = ' +
117119
getRequire('template', parts.template[0], 0, hasLocalStyles)
118120
}
119121

@@ -140,7 +142,7 @@ module.exports = function (content) {
140142
'var hotAPI = require(' + hotReloadAPIPath + ')\n' +
141143
'hotAPI.install(require("vue"))\n' +
142144
'if (!hotAPI.compatible) return\n' +
143-
'var id = module.exports.hotID = ' + (scriptString || templateString) + '\n' +
145+
'var id = ' + (scriptString || templateString) + '\n' +
144146
// create the record
145147
'hotAPI.createRecord(id, module.exports)\n' +
146148
'module.hot.accept(' + JSON.stringify(accepted) + ', function () {\n' +

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-loader",
3-
"version": "4.0.9",
3+
"version": "4.0.10",
44
"description": "Vue.js component loader for Webpack",
55
"main": "index.js",
66
"repository": {
@@ -28,7 +28,7 @@
2828
"parse5": "^1.5.0",
2929
"postcss": "^4.1.16",
3030
"postcss-selector-parser": "^1.1.2",
31-
"vue-hot-reload-api": "^1.1.0"
31+
"vue-hot-reload-api": "^1.2.0"
3232
},
3333
"peerDependencies": {
3434
"vue-html-loader": "*",

0 commit comments

Comments
 (0)