@@ -65,6 +65,13 @@ module.exports = function(content, file, conf) {
6565 isJsLike : true
6666 } ) ;
6767
68+ scriptStr += '\nvar __vue__options__;\n' ;
69+ scriptStr += 'if(module.exports.__esModule && module.exports.default){\n' ;
70+ scriptStr += ' __vue__options__ = module.exports.default;\n' ;
71+ scriptStr += '}else{\n' ;
72+ scriptStr += ' __vue__options__ = module.exports;\n' ;
73+ scriptStr += '}\n' ;
74+
6875 if ( output . template ) {
6976 var templateContent = fis . compile . partial ( output . template . content , file , {
7077 ext : output . template . lang || 'html' ,
@@ -74,17 +81,12 @@ module.exports = function(content, file, conf) {
7481 if ( configs . runtimeOnly ) {
7582 var result = compileTemplate ( templateContent ) ;
7683 if ( result ) {
77- scriptStr += '\n;\n(function(renderFun, staticRenderFns){\n'
78- scriptStr += '\nif(module && module.exports){ module.exports.render=renderFun; module.exports.staticRenderFns=staticRenderFns;}\n' ;
79- scriptStr += '\nif(exports && exports.default){ exports.default.render=renderFun; exports.default.staticRenderFns=staticRenderFns;}\n' ;
80- scriptStr += '\n})(' + result . render + ',' + result . staticRenderFns + ');\n' ;
84+ scriptStr += '__vue__options__.render =' + result . render + '\n' ;
85+ scriptStr += '__vue__options__.staticRenderFns =' + result . staticRenderFns + '\n' ;
8186 }
8287 } else {
8388 // template
84- scriptStr += '\n;\n(function(template){\n'
85- scriptStr += '\nmodule && module.exports && (module.exports.template = template);\n' ;
86- scriptStr += '\nexports && exports.default && (exports.default.template = template);\n' ;
87- scriptStr += '\n})(' + JSON . stringify ( templateContent ) + ');\n' ;
89+ scriptStr += '__vue__options__.template = ' + JSON . stringify ( templateContent ) + '\n' ;
8890 }
8991 }
9092
0 commit comments