@@ -18,16 +18,8 @@ export function exportLazyModuleMap(
18
18
19
19
const modules = Object . keys ( lazyRoutes )
20
20
. map ( ( loadChildrenString ) => {
21
- let [ , moduleName ] = loadChildrenString . split ( '#' ) ;
22
- let modulePath = lazyRoutes [ loadChildrenString ] ;
23
-
24
- if ( modulePath . match ( / \. n g f a c t o r y \. [ j t ] s $ / ) ) {
25
- modulePath = modulePath . replace ( '.ngfactory' , '' ) ;
26
- moduleName = moduleName . replace ( 'NgFactory' , '' ) ;
27
- loadChildrenString = loadChildrenString
28
- . replace ( '.ngfactory' , '' )
29
- . replace ( 'NgFactory' , '' ) ;
30
- }
21
+ const [ , moduleName ] = loadChildrenString . split ( '#' ) ;
22
+ const modulePath = lazyRoutes [ loadChildrenString ] ;
31
23
32
24
return {
33
25
modulePath,
@@ -52,10 +44,17 @@ export function exportLazyModuleMap(
52
44
} ) ;
53
45
54
46
const lazyModuleObjectLiteral = ts . createObjectLiteral (
55
- modules . map ( ( mod , idx ) => ts . createPropertyAssignment (
56
- ts . createLiteral ( mod . loadChildrenString ) ,
57
- ts . createPropertyAccess ( ts . createIdentifier ( `__lazy_${ idx } __` ) , mod . moduleName ) )
58
- )
47
+ modules . map ( ( mod , idx ) => {
48
+ let [ modulePath , moduleName ] = mod . loadChildrenString . split ( '#' ) ;
49
+ if ( modulePath . match ( / \. n g f a c t o r y / ) ) {
50
+ modulePath = modulePath . replace ( '.ngfactory' , '' ) ;
51
+ moduleName = moduleName . replace ( 'NgFactory' , '' ) ;
52
+ }
53
+
54
+ return ts . createPropertyAssignment (
55
+ ts . createLiteral ( `${ modulePath } #${ moduleName } ` ) ,
56
+ ts . createPropertyAccess ( ts . createIdentifier ( `__lazy_${ idx } __` ) , mod . moduleName ) ) ;
57
+ } )
59
58
) ;
60
59
61
60
const lazyModuleVariableStmt = ts . createVariableStatement (
0 commit comments