@@ -29,6 +29,11 @@ module.exports = function (content) {
2929 var options = this . options . vue || { }
3030 var vueUrl = loaderUtils . getRemainingRequest ( this )
3131
32+ // respect user babel options
33+ if ( this . options . babel ) {
34+ defaultLoaders . js = 'babel'
35+ }
36+
3237 // check if there are custom loaders specified with
3338 // vueLoader.withLoaders(), otherwise use defaults
3439 var loaders = assign ( { } , defaultLoaders , options . loaders )
@@ -139,8 +144,9 @@ module.exports = function (content) {
139144
140145 // add require for script
141146 if ( parts . script . length ) {
142- output += 'module.exports = ' +
143- getRequire ( 'script' , parts . script [ 0 ] , 0 )
147+ output +=
148+ 'module.exports = ' + getRequire ( 'script' , parts . script [ 0 ] , 0 ) + '\n' +
149+ 'if (module.exports.__esModule) module.exports = module.exports.default\n'
144150 }
145151
146152 // add require for template
@@ -178,6 +184,7 @@ module.exports = function (content) {
178184 'hotAPI.createRecord(id, module.exports)\n' +
179185 'module.hot.accept(' + JSON . stringify ( accepted ) + ', function () {\n' +
180186 'var newOptions = ' + ( scriptString ? 'require(' + scriptString + ')\n' : 'null\n' ) +
187+ 'if (newOptions.__esModule) newOptions = newOptions.default\n' +
181188 'var newTemplate = ' + ( templateString ? 'require(' + templateString + ')\n' : 'null\n' ) +
182189 'hotAPI.update(id, newOptions, newTemplate)\n' +
183190 '})\n' +
0 commit comments