@@ -28,7 +28,6 @@ export interface AotPluginOptions {
28
28
29
29
export interface LazyRoute {
30
30
moduleRoute : ModuleRoute ;
31
- moduleRelativePath : string ;
32
31
moduleAbsolutePath : string ;
33
32
}
34
33
@@ -260,10 +259,8 @@ export class AotPlugin {
260
259
}
261
260
262
261
private _resolveModulePath ( module : ModuleRoute , containingFile : string ) {
263
- if ( module . path . startsWith ( '.' ) ) {
264
- return path . join ( path . dirname ( containingFile ) , module . path ) ;
265
- }
266
- return module . path ;
262
+ return this . _reflectorHost . findDeclaration ( module . path , module . className , containingFile )
263
+ . filePath ;
267
264
}
268
265
269
266
private _processNgModule ( module : ModuleRoute , containingFile : string | null ) : LazyRouteMap {
@@ -278,14 +275,9 @@ export class AotPlugin {
278
275
const entryNgModuleMetadata = this . getNgModuleMetadata ( staticSymbol ) ;
279
276
const loadChildrenRoute : LazyRoute [ ] = this . extractLoadChildren ( entryNgModuleMetadata )
280
277
. map ( route => {
281
- const mr = ModuleRoute . fromString ( route ) ;
282
- const relativePath = this . _resolveModulePath ( mr , relativeModulePath ) ;
283
- const absolutePath = path . join ( this . genDir , relativePath ) ;
284
- return {
285
- moduleRoute : mr ,
286
- moduleRelativePath : relativePath ,
287
- moduleAbsolutePath : absolutePath
288
- } ;
278
+ const moduleRoute = ModuleRoute . fromString ( route ) ;
279
+ const moduleAbsolutePath = this . _resolveModulePath ( moduleRoute , relativeModulePath ) ;
280
+ return { moduleRoute, moduleAbsolutePath } ;
289
281
} ) ;
290
282
const resultMap : LazyRouteMap = loadChildrenRoute
291
283
. reduce ( ( acc : LazyRouteMap , curr : LazyRoute ) => {
@@ -347,7 +339,8 @@ export class AotPlugin {
347
339
}
348
340
} )
349
341
// Poor man's flat map.
350
- . reduce ( ( acc : any [ ] , i : any ) => acc . concat ( i ) , [ ] ) )
342
+ . reduce ( ( acc : any [ ] , i : any ) => acc . concat ( i ) , [ ] )
343
+ )
351
344
. filter ( x => ! ! x ) ;
352
345
}
353
346
0 commit comments