mirror of
https://github.com/status-im/react-native.git
synced 2025-02-05 14:13:26 +00:00
[react-packager] small fixes to image loader
This commit is contained in:
parent
310aef9dcc
commit
d3054788da
@ -134,14 +134,18 @@ DependecyGraph.prototype.resolveDependency = function(
|
|||||||
fromModule,
|
fromModule,
|
||||||
depModuleId
|
depModuleId
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
if (this._assetMap != null) {
|
||||||
// Process asset requires.
|
// Process asset requires.
|
||||||
var assetMatch = depModuleId.match(/^image!(.+)/);
|
var assetMatch = depModuleId.match(/^image!(.+)/);
|
||||||
if (assetMatch && assetMatch[1]) {
|
if (assetMatch && assetMatch[1]) {
|
||||||
if (!this._assetMap[assetMatch[1]]) {
|
if (!this._assetMap[assetMatch[1]]) {
|
||||||
throw new Error('Cannot find asset: ' + assetMatch[1]);
|
console.warn('Cannot find asset: ' + assetMatch[1]);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return this._assetMap[assetMatch[1]];
|
return this._assetMap[assetMatch[1]];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var packageJson, modulePath, dep;
|
var packageJson, modulePath, dep;
|
||||||
|
|
||||||
@ -577,7 +581,8 @@ function buildAssetMap(roots, exts) {
|
|||||||
} else {
|
} else {
|
||||||
var ext = path.extname(file).replace(/^\./, '');
|
var ext = path.extname(file).replace(/^\./, '');
|
||||||
if (exts.indexOf(ext) !== -1) {
|
if (exts.indexOf(ext) !== -1) {
|
||||||
var assetName = path.basename(file, '.' + ext);
|
var assetName = path.basename(file, '.' + ext)
|
||||||
|
.replace(/@[\d\.]+x/, '');
|
||||||
if (map[assetName] != null) {
|
if (map[assetName] != null) {
|
||||||
debug('Conflcting assets', assetName);
|
debug('Conflcting assets', assetName);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user