Skip to content

Commit bf381e6

Browse files
committed
fix webpack 2 compat
1 parent 73fcd8c commit bf381e6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/loader.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,17 @@ module.exports = function (content) {
163163
var exports =
164164
'__vue_options__ = __vue_exports__ || {}\n' +
165165
// ES6 modules interop
166-
'if (__vue_options__.__esModule || typeof __vue_options__.default === "object")\n' +
167-
'__vue_options__ = __vue_options__.default\n' +
166+
'if (__vue_options__.__esModule) {\n' +
167+
' __vue_options__ = __vue_options__.default\n' +
168+
// Webpack 2 interop
169+
'} else if (typeof __vue_options__.default === "object") {\n' +
170+
' __vue_options__ = __vue_options__.default\n' +
171+
' __vue_exports__.__esModule = true\n' +
172+
'}\n' +
168173
// constructor export interop
169-
'if (typeof __vue_options__ === "function") __vue_options__ = __vue_options__.options\n'
174+
'if (typeof __vue_options__ === "function") {\n' +
175+
' __vue_options__ = __vue_options__.options\n' +
176+
'}\n'
170177

171178
// add require for template
172179
var template = parts.template

0 commit comments

Comments
 (0)