File tree 3 files changed +7
-17
lines changed
3 files changed +7
-17
lines changed Original file line number Diff line number Diff line change @@ -161,15 +161,11 @@ module.exports = function (content) {
161
161
}
162
162
163
163
var exports =
164
- '__vue_options__ = __vue_exports__ = ' +
165
- '__vue_exports__ || { default: {}, __esModule: true }\n' +
164
+ '__vue_options__ = __vue_exports__ = __vue_exports__ || {}\n' +
166
165
// ES6 modules interop
167
- 'if (__vue_options__.__esModule) {\n' +
168
- ' __vue_options__ = __vue_options__.default\n' +
169
- // Webpack 2 interop
170
- '} else if (typeof __vue_options__.default === "object") {\n' +
171
- ' __vue_options__ = __vue_options__.default\n' +
172
- ' __vue_exports__.__esModule = true\n' +
166
+ 'if (typeof __vue_exports__.default === "object") {\n' +
167
+ ( isProduction ? '' : 'if (Object.keys(__vue_exports__).length > 1) console.error("[vue-loader]: named exports are not supported.")\n' ) +
168
+ '__vue_options__ = __vue_exports__ = __vue_exports__.default\n' +
173
169
'}\n' +
174
170
// constructor export interop
175
171
'if (typeof __vue_options__ === "function") {\n' +
@@ -230,15 +226,15 @@ module.exports = function (content) {
230
226
'")}\n'
231
227
}
232
228
// final export
233
- output += '\nmodule.exports = __vue_exports__ || __vue_options__ \n'
229
+ output += '\nmodule.exports = __vue_exports__\n'
234
230
} else {
235
231
// inject-loader support
236
232
output +=
237
233
'\n/* dependency injection */\n' +
238
234
'module.exports = function (injections) {\n' +
239
235
' __vue_exports__ = __vue_exports__(injections)\n' +
240
236
exports +
241
- ' return __vue_exports__ || __vue_options__ \n' +
237
+ ' return __vue_exports__\n' +
242
238
'}'
243
239
}
244
240
Original file line number Diff line number Diff line change 3
3
</template >
4
4
5
5
<script >
6
- export function test () {
7
- return ' hi'
8
- }
9
-
10
6
export default {
11
7
data () {
12
8
return {
Original file line number Diff line number Diff line change @@ -79,8 +79,6 @@ describe('vue-loader', function () {
79
79
test ( {
80
80
entry : './test/fixtures/basic.vue'
81
81
} , function ( window , module , rawModule ) {
82
- // test named export
83
- expect ( rawModule . test ( ) ) . to . equal ( 'hi' )
84
82
assertRenderFn ( module , '<h2 class="red">{{msg}}</h2>' )
85
83
expect ( module . data ( ) . msg ) . to . contain ( 'Hello from Component A!' )
86
84
var style = window . document . querySelector ( 'style' ) . textContent
@@ -183,7 +181,7 @@ describe('vue-loader', function () {
183
181
column : col
184
182
} )
185
183
expect ( pos . source . indexOf ( 'basic.vue' ) > - 1 )
186
- expect ( pos . line ) . to . equal ( 13 )
184
+ expect ( pos . line ) . to . equal ( 9 )
187
185
done ( )
188
186
} )
189
187
} )
You can’t perform that action at this time.
0 commit comments