@@ -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' +
0 commit comments