@@ -21,6 +21,7 @@ process.on('SIGPIPE', () => {
2121//#endregion
2222
2323//#region Add support for redirecting the loading of node modules
24+
2425exports . injectNodeModuleLookupPath = function ( injectPath ) {
2526 if ( ! injectPath ) {
2627 throw new Error ( 'Missing injectPath' ) ;
@@ -36,18 +37,16 @@ exports.injectNodeModuleLookupPath = function (injectPath) {
3637 const originalResolveLookupPaths = Module . _resolveLookupPaths ;
3738
3839 // @ts -ignore
39- Module . _resolveLookupPaths = function ( moduleName , parent , newReturn ) {
40- const result = originalResolveLookupPaths ( moduleName , parent , newReturn ) ;
41-
42- const paths = newReturn ? result : result [ 1 ] ;
40+ Module . _resolveLookupPaths = function ( moduleName , parent ) {
41+ const paths = originalResolveLookupPaths ( moduleName , parent ) ;
4342 for ( let i = 0 , len = paths . length ; i < len ; i ++ ) {
4443 if ( paths [ i ] === nodeModulesPath ) {
4544 paths . splice ( i , 0 , injectPath ) ;
4645 break ;
4746 }
4847 }
4948
50- return result ;
49+ return paths ;
5150 } ;
5251} ;
5352//#endregion
@@ -71,19 +70,18 @@ exports.enableASARSupport = function (nodeModulesPath) {
7170
7271 // @ts -ignore
7372 const originalResolveLookupPaths = Module . _resolveLookupPaths ;
74- // @ts -ignore
75- Module . _resolveLookupPaths = function ( request , parent , newReturn ) {
76- const result = originalResolveLookupPaths ( request , parent , newReturn ) ;
7773
78- const paths = newReturn ? result : result [ 1 ] ;
74+ // @ts -ignore
75+ Module . _resolveLookupPaths = function ( request , parent ) {
76+ const paths = originalResolveLookupPaths ( request , parent ) ;
7977 for ( let i = 0 , len = paths . length ; i < len ; i ++ ) {
8078 if ( paths [ i ] === NODE_MODULES_PATH ) {
8179 paths . splice ( i , 0 , NODE_MODULES_ASAR_PATH ) ;
8280 break ;
8381 }
8482 }
8583
86- return result ;
84+ return paths ;
8785 } ;
8886} ;
8987//#endregion
0 commit comments