mirror of https://github.com/status-im/metro.git
[ReactNative] Respect --assets-dest in "download from server" mode
This commit is contained in:
parent
1b4c460bc7
commit
c4f5334e92
|
@ -334,6 +334,8 @@ class Server {
|
||||||
requestType = 'bundle';
|
requestType = 'bundle';
|
||||||
} else if (pathname.match(/\.map$/)) {
|
} else if (pathname.match(/\.map$/)) {
|
||||||
requestType = 'map';
|
requestType = 'map';
|
||||||
|
} else if (pathname.match(/\.assets$/)) {
|
||||||
|
requestType = 'assets';
|
||||||
} else if (pathname.match(/^\/debug/)) {
|
} else if (pathname.match(/^\/debug/)) {
|
||||||
this._processDebugRequest(req.url, res);
|
this._processDebugRequest(req.url, res);
|
||||||
return;
|
return;
|
||||||
|
@ -372,6 +374,11 @@ class Server {
|
||||||
res.setHeader('Content-Type', 'application/json');
|
res.setHeader('Content-Type', 'application/json');
|
||||||
res.end(sourceMap);
|
res.end(sourceMap);
|
||||||
Activity.endEvent(startReqEventId);
|
Activity.endEvent(startReqEventId);
|
||||||
|
} else if (requestType === 'assets') {
|
||||||
|
var assetsList = JSON.stringify(p.getAssets());
|
||||||
|
res.setHeader('Content-Type', 'application/json');
|
||||||
|
res.end(assetsList);
|
||||||
|
Activity.endEvent(startReqEventId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
this._handleError.bind(this, res, optionsJson)
|
this._handleError.bind(this, res, optionsJson)
|
||||||
|
@ -416,7 +423,7 @@ class Server {
|
||||||
// entry module name. We can safely remove these options.
|
// entry module name. We can safely remove these options.
|
||||||
const entryFile = pathname.replace(/^\//, '').split('.').filter(part => {
|
const entryFile = pathname.replace(/^\//, '').split('.').filter(part => {
|
||||||
if (part === 'includeRequire' || part === 'runModule' ||
|
if (part === 'includeRequire' || part === 'runModule' ||
|
||||||
part === 'bundle' || part === 'map') {
|
part === 'bundle' || part === 'map' || part === 'assets') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue