@@ -61,8 +61,7 @@ var Module = function(context, filename) {
6161 this . require = bind1 ( context . moduleRequire , context , this ) ;
6262 this . require . resolve = bind1 ( context . moduleResolve , context , this ) ;
6363 this . require . cache = context . cache ;
64- this . parent = null ;
65- this . children = [ ] ;
64+ this . require . main = context . main ;
6665 this . preloaded = false ;
6766 this . loaded = false ;
6867 this . exports = { } ;
@@ -83,7 +82,8 @@ var start = function(context) {
8382
8483 var main = config . main ;
8584 actions = actions . thenSync ( main ? function ( ) {
86- return context . execModuleCall ( main ) ;
85+ var res = context . main = context . execModuleCall ( main ) ;
86+ return res ;
8787 } : function ( ) { } /* if there is no main module, an empty parameter should be passed to onstart */ ) ;
8888
8989 actions = actions . thenSync ( config . onstart ) ;
@@ -174,13 +174,6 @@ contextProto.modulePreload = function(module, parent) {
174174 return preloading ;
175175 }
176176 var self = this ;
177- if ( parent && parent . id != '.' ) {
178- module . parent = parent ;
179- module . require . main = parent . require . main ;
180- parent . children . push ( module ) ;
181- } else {
182- module . require . main = module ;
183- }
184177 setModuleProperty ( module , PROPERTY_PRELOADING_PARENTS , parent ? [ parent ] : [ ] ) ;
185178 return setModuleProperty ( module , PROPERTY_PRELOADING , self . moduleLoadDefinition ( module ) . thenSync ( function ( ) {
186179 return self . modulePreloadDependencies ( module , getModuleProperty ( module , PROPERTY_DEPENDENCIES ) ) ;
0 commit comments