@@ -105,15 +105,17 @@ module.exports = function (content) {
105
105
output += getRequire ( 'style' , style , i , style . scoped )
106
106
} )
107
107
108
- // only one script tag allowed
108
+ // add require for script
109
109
if ( parts . script . length ) {
110
110
output += 'module.exports = ' +
111
111
getRequire ( 'script' , parts . script [ 0 ] , 0 )
112
112
}
113
113
114
- // only one template tag allowed
114
+ // add require for template
115
115
if ( parts . template . length ) {
116
- output += 'module.exports.template = ' +
116
+ output += ';(typeof module.exports === "function" ' +
117
+ '? module.exports.options ' +
118
+ ': module.exports).template = ' +
117
119
getRequire ( 'template' , parts . template [ 0 ] , 0 , hasLocalStyles )
118
120
}
119
121
@@ -140,7 +142,7 @@ module.exports = function (content) {
140
142
'var hotAPI = require(' + hotReloadAPIPath + ')\n' +
141
143
'hotAPI.install(require("vue"))\n' +
142
144
'if (!hotAPI.compatible) return\n' +
143
- 'var id = module.exports.hotID = ' + ( scriptString || templateString ) + '\n' +
145
+ 'var id = ' + ( scriptString || templateString ) + '\n' +
144
146
// create the record
145
147
'hotAPI.createRecord(id, module.exports)\n' +
146
148
'module.hot.accept(' + JSON . stringify ( accepted ) + ', function () {\n' +
0 commit comments