File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -281,10 +281,12 @@ function guardArrayAssets (assets) {
281
281
var asset
282
282
while ( i -- ) {
283
283
asset = assets [ i ]
284
- var id = asset . name || ( asset . options && asset . options . name )
284
+ var id = typeof asset === 'function'
285
+ ? ( ( asset . options && asset . options . name ) || asset . id )
286
+ : ( asset . name || asset . id )
285
287
if ( ! id ) {
286
288
process . env . NODE_ENV !== 'production' && _ . warn (
287
- 'Array-syntax assets must provide a "name" field.'
289
+ 'Array-syntax assets must provide a "name" or "id" field.'
288
290
)
289
291
} else {
290
292
res [ id ] = asset
Original file line number Diff line number Diff line change @@ -327,7 +327,20 @@ describe('Util - Option merging', function () {
327
327
components : [ { } ]
328
328
}
329
329
merge ( a , b )
330
- expect ( hasWarned ( _ , 'must provide a "name" field' ) ) . toBe ( true )
330
+ expect ( hasWarned ( _ , 'must provide a "name" or "id" field' ) ) . toBe ( true )
331
+ } )
332
+
333
+ it ( 'warn Array async component without id' , function ( ) {
334
+ var a = {
335
+ components : {
336
+ a : Vue . extend ( { } )
337
+ }
338
+ }
339
+ var b = {
340
+ components : [ function ( ) { } ]
341
+ }
342
+ merge ( a , b )
343
+ expect ( hasWarned ( _ , 'must provide a "name" or "id" field' ) ) . toBe ( true )
331
344
} )
332
345
333
346
} )
You can’t perform that action at this time.
0 commit comments