File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -689,7 +689,7 @@ var pathModule = createInternalModule("path", function (exports) {
689689 joined += part ;
690690 }
691691 // replace /foo/../bar/baz with /bar/baz
692- while ( dotdotre . exec ( joined ) ) joined . replace ( dotdotre , dotdotreplace ) ;
692+ while ( dotdotre . exec ( joined ) ) joined = joined . replace ( dotdotre , dotdotreplace ) ;
693693 return joined ;
694694
695695 } ;
@@ -782,15 +782,19 @@ function loadModule (request, parent) {
782782 // This is the promise which is actually returned from require.async()
783783 var loadPromise = new process . Promise ( ) ;
784784
785- debug ( "loadModule REQUEST " + JSON . stringify ( request ) + " parent: " + JSON . stringify ( parent ) ) ;
785+ // debug("loadModule REQUEST " + (request) + " parent: " + JSON.stringify(parent));
786786
787787 var id , paths ;
788788 if ( request . charAt ( 0 ) == "." && ( request . charAt ( 1 ) == "/" || request . charAt ( 1 ) == "." ) ) {
789789 // Relative request
790- id = path . join ( path . dirname ( parent . id ) , request ) ;
790+ var parentIdPath = path . dirname ( parent . id +
791+ ( path . filename ( parent . filename ) . match ( / ^ i n d e x \. ( j s | a d d o n ) $ / ) ? "/" : "" ) ) ;
792+ id = path . join ( parentIdPath , request ) ;
793+ debug ( "RELATIVE: requested:" + request + " set ID to: " + id + " from " + parent . id + "(" + parentIdPath + ")" ) ;
791794 paths = [ path . dirname ( parent . filename ) ] ;
792795 } else {
793796 id = request ;
797+ debug ( "ABSOLUTE: id=" + id ) ;
794798 paths = process . paths ;
795799 }
796800
You can’t perform that action at this time.
0 commit comments