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) {
281281 var asset
282282 while ( i -- ) {
283283 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 )
285287 if ( ! id ) {
286288 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.'
288290 )
289291 } else {
290292 res [ id ] = asset
Original file line number Diff line number Diff line change @@ -327,7 +327,20 @@ describe('Util - Option merging', function () {
327327 components : [ { } ]
328328 }
329329 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 )
331344 } )
332345
333346} )
You can’t perform that action at this time.
0 commit comments