diff --git a/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js b/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js index 87e00260..ebe7c39a 100644 --- a/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js +++ b/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js @@ -279,16 +279,16 @@ class ResolutionRequest { _resolveNodeDependency(fromModule, toModuleName) { if (toModuleName[0] === '.' || toModuleName[1] === '/') { - return this._resolveFileOrDir(fromModule, toModuleName) + return this._resolveFileOrDir(fromModule, toModuleName); } else { return this._redirectRequire(fromModule, toModuleName).then( realModuleName => { if (realModuleName[0] === '.' || realModuleName[1] === '/') { // derive absolute path /.../node_modules/fromModuleDir/realModuleName - let fromModuleParentIdx = fromModule.path.lastIndexOf('node_modules/') + 13 - let fromModuleDir = fromModule.path.slice(0, fromModule.path.indexOf('/', fromModuleParentIdx)) - let absPath = path.join(fromModuleDir, realModuleName) - return this._resolveFileOrDir(fromModule, absPath) + const fromModuleParentIdx = fromModule.path.lastIndexOf('node_modules/') + 13; + const fromModuleDir = fromModule.path.slice(0, fromModule.path.indexOf('/', fromModuleParentIdx)); + const absPath = path.join(fromModuleDir, realModuleName); + return this._resolveFileOrDir(fromModule, absPath); } const searchQueue = [];