@@ -10,22 +10,25 @@ export class ModuleTokenFactory {
1010 scope : Type < any > [ ] ,
1111 dynamicModuleMetadata ?: Partial < DynamicModule > | undefined ,
1212 ) : string {
13- const reflectedScope = this . reflectScope ( metatype ) ;
14- const isSingleScoped = reflectedScope === true ;
13+ const moduleScope = this . reflectScope ( metatype ) ;
14+ const isSingleScoped = moduleScope === true ;
1515 const opaqueToken = {
1616 module : this . getModuleName ( metatype ) ,
1717 dynamic : this . getDynamicMetadataToken ( dynamicModuleMetadata ) ,
18- scope : isSingleScoped ? this . getScopeStack ( scope ) : reflectedScope ,
18+ scope : isSingleScoped ? this . getScopeStack ( scope ) : moduleScope ,
1919 } ;
2020 return hash ( opaqueToken ) ;
2121 }
2222
2323 public getDynamicMetadataToken (
2424 dynamicModuleMetadata : Partial < DynamicModule > | undefined ,
2525 ) : string {
26- // Uses safeStringify instead of JSON.stringify
27- // to support circular dynamic modules
28- return dynamicModuleMetadata ? stringify ( dynamicModuleMetadata , this . replacer ) : '' ;
26+ // Uses safeStringify instead of JSON.stringify to support circular dynamic modules
27+ // The replacer function is also required in order to obtain real class names
28+ // instead of the unified "Function" key
29+ return dynamicModuleMetadata
30+ ? stringify ( dynamicModuleMetadata , this . replacer )
31+ : '' ;
2932 }
3033
3134 public getModuleName ( metatype : Type < any > ) : string {
@@ -54,8 +57,7 @@ export class ModuleTokenFactory {
5457 private replacer ( key : string , value : any ) {
5558 if ( typeof value === 'function' ) {
5659 return value . name ;
57- } else {
58- return value ;
5960 }
61+ return value ;
6062 }
6163}
0 commit comments