@@ -88,28 +88,30 @@ export function createRouterMatcher(
88
88
mainNormalizedRecord . aliasOf = originalRecord && originalRecord . record
89
89
const options : PathParserOptions = mergeOptions ( globalOptions , record )
90
90
// generate an array of records to correctly handle aliases
91
- const normalizedRecords : ( typeof mainNormalizedRecord ) [ ] = [
92
- mainNormalizedRecord ,
93
- ]
91
+ const normalizedRecords : RouteRecordNormalized [ ] = [ mainNormalizedRecord ]
94
92
if ( 'alias' in record ) {
95
93
const aliases =
96
94
typeof record . alias === 'string' ? [ record . alias ] : record . alias !
97
95
for ( const alias of aliases ) {
98
96
normalizedRecords . push (
99
- assign ( { } , mainNormalizedRecord , {
100
- // this allows us to hold a copy of the `components` option
101
- // so that async components cache is hold on the original record
102
- components : originalRecord
103
- ? originalRecord . record . components
104
- : mainNormalizedRecord . components ,
105
- path : alias ,
106
- // we might be the child of an alias
107
- aliasOf : originalRecord
108
- ? originalRecord . record
109
- : mainNormalizedRecord ,
110
- // the aliases are always of the same kind as the original since they
111
- // are defined on the same record
112
- } ) as typeof mainNormalizedRecord
97
+ // we need to normalize again to ensure the `mods` property
98
+ // being non enumerable
99
+ normalizeRouteRecord (
100
+ assign ( { } , mainNormalizedRecord , {
101
+ // this allows us to hold a copy of the `components` option
102
+ // so that async components cache is hold on the original record
103
+ components : originalRecord
104
+ ? originalRecord . record . components
105
+ : mainNormalizedRecord . components ,
106
+ path : alias ,
107
+ // we might be the child of an alias
108
+ aliasOf : originalRecord
109
+ ? originalRecord . record
110
+ : mainNormalizedRecord ,
111
+ // the aliases are always of the same kind as the original since they
112
+ // are defined on the same record
113
+ } )
114
+ )
113
115
)
114
116
}
115
117
}
@@ -379,14 +381,14 @@ function paramsFromLocation(
379
381
* @returns the normalized version
380
382
*/
381
383
export function normalizeRouteRecord (
382
- record : RouteRecordRaw
384
+ record : RouteRecordRaw & { aliasOf ?: RouteRecordNormalized }
383
385
) : RouteRecordNormalized {
384
386
const normalized : Omit < RouteRecordNormalized , 'mods' > = {
385
387
path : record . path ,
386
388
redirect : record . redirect ,
387
389
name : record . name ,
388
390
meta : record . meta || { } ,
389
- aliasOf : undefined ,
391
+ aliasOf : record . aliasOf ,
390
392
beforeEnter : record . beforeEnter ,
391
393
props : normalizeRecordProps ( record ) ,
392
394
children : record . children || [ ] ,
0 commit comments