diff --git a/react-packager/src/AssetServer/index.js b/react-packager/src/AssetServer/index.js index c9b198a5..65f1edcf 100644 --- a/react-packager/src/AssetServer/index.js +++ b/react-packager/src/AssetServer/index.js @@ -106,7 +106,8 @@ class AssetServer { return ( this._findRoot( this._roots, - path.dirname(assetPath) + path.dirname(assetPath), + assetPath, ) .then(dir => Promise.all([ dir, @@ -138,7 +139,7 @@ class AssetServer { ); } - _findRoot(roots, dir) { + _findRoot(roots, dir, debugInfoFile) { return Promise.all( roots.map(root => { const absRoot = path.resolve(root); @@ -162,7 +163,9 @@ class AssetServer { return stats[i].path; } } - throw new Error('Could not find any directories'); + + const rootsString = roots.map(s => `'${s}'`).join(', '); + throw new Error(`'${debugInfoFile}' could not be found, because '${dir}' is not a subdirectory of any of the roots (${rootsString})`); }); } @@ -194,7 +197,7 @@ class AssetServer { return map; } - + _getAssetDataFromName(platform, file) { return getAssetDataFromName(file, platform); }