@@ -29,6 +29,11 @@ module.exports = function (content) {
29
29
var options = this . options . vue || { }
30
30
var vueUrl = loaderUtils . getRemainingRequest ( this )
31
31
32
+ // respect user babel options
33
+ if ( this . options . babel ) {
34
+ defaultLoaders . js = 'babel'
35
+ }
36
+
32
37
// check if there are custom loaders specified with
33
38
// vueLoader.withLoaders(), otherwise use defaults
34
39
var loaders = assign ( { } , defaultLoaders , options . loaders )
@@ -139,8 +144,9 @@ module.exports = function (content) {
139
144
140
145
// add require for script
141
146
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'
144
150
}
145
151
146
152
// add require for template
@@ -178,6 +184,7 @@ module.exports = function (content) {
178
184
'hotAPI.createRecord(id, module.exports)\n' +
179
185
'module.hot.accept(' + JSON . stringify ( accepted ) + ', function () {\n' +
180
186
'var newOptions = ' + ( scriptString ? 'require(' + scriptString + ')\n' : 'null\n' ) +
187
+ 'if (newOptions.__esModule) newOptions = newOptions.default\n' +
181
188
'var newTemplate = ' + ( templateString ? 'require(' + templateString + ')\n' : 'null\n' ) +
182
189
'hotAPI.update(id, newOptions, newTemplate)\n' +
183
190
'})\n' +
0 commit comments