[react-packager] Sourcemap url should include the same args as the bundle url
Summary: Sourcemap urls were generated as just the pathname (no options) which meant that they generated source for the wrong bundle. Even worse, there exists a race condition when multiple request to the same bundle has different types of paltform arguments (in this case one could be 'ios' and the other is undefined). The fix will this will come later as it's more involved -- will need to refactor the dependency resolver to have a per-request state.
This commit is contained in:
parent
c069035479
commit
62f9059f85
|
@ -125,7 +125,7 @@ describe('processRequest', () => {
|
|||
expect(Bundler.prototype.bundle).toBeCalledWith(
|
||||
'index.js',
|
||||
true,
|
||||
'index.map',
|
||||
'index.map?platform=ios',
|
||||
true,
|
||||
'ios',
|
||||
);
|
||||
|
@ -270,7 +270,7 @@ describe('processRequest', () => {
|
|||
expect(Bundler.prototype.bundle).toBeCalledWith(
|
||||
'path/to/foo.js',
|
||||
false,
|
||||
'/path/to/foo.map',
|
||||
'/path/to/foo.map?dev=false&runModule=false',
|
||||
false,
|
||||
undefined
|
||||
);
|
||||
|
|
|
@ -429,8 +429,11 @@ class Server {
|
|||
return true;
|
||||
}).join('.') + '.js';
|
||||
|
||||
const sourceMapUrlObj = _.clone(urlObj);
|
||||
sourceMapUrlObj.pathname = pathname.replace(/\.bundle$/, '.map');
|
||||
|
||||
return {
|
||||
sourceMapUrl: pathname.replace(/\.bundle$/, '.map'),
|
||||
sourceMapUrl: url.format(sourceMapUrlObj),
|
||||
entryFile: entryFile,
|
||||
dev: this._getBoolOptionFromQuery(urlObj.query, 'dev', true),
|
||||
minify: this._getBoolOptionFromQuery(urlObj.query, 'minify'),
|
||||
|
|
Loading…
Reference in New Issue