Fix loading minified bundle over HTTP

Summary: Sets `generateSourceMaps` to true when requesting a bundle in non-dev mode or minified.

Reviewed By: bestander, cpojer

Differential Revision: D4415492

fbshipit-source-id: 9b4dcbd577a535dab143bb7a067210fbd831bf1a
This commit is contained in:
David Aurelio 2017-01-13 10:28:39 -08:00 committed by Facebook Github Bot
parent c8962a1d9b
commit 279f11a344
2 changed files with 6 additions and 4 deletions

View File

@ -442,7 +442,7 @@ describe('processRequest', () => {
entryFile: 'path/to/foo.js', entryFile: 'path/to/foo.js',
inlineSourceMap: false, inlineSourceMap: false,
minify: false, minify: false,
generateSourceMaps: false, generateSourceMaps: true,
hot: false, hot: false,
runModule: false, runModule: false,
sourceMapUrl: '/path/to/foo.map?dev=false&runModule=false', sourceMapUrl: '/path/to/foo.map?dev=false&runModule=false',

View File

@ -926,11 +926,13 @@ class Server {
assetPlugin : assetPlugin :
(typeof assetPlugin === 'string') ? [assetPlugin] : []; (typeof assetPlugin === 'string') ? [assetPlugin] : [];
const dev = this._getBoolOptionFromQuery(urlObj.query, 'dev', true);
const minify = this._getBoolOptionFromQuery(urlObj.query, 'minify', false);
return { return {
sourceMapUrl: url.format(sourceMapUrlObj), sourceMapUrl: url.format(sourceMapUrlObj),
entryFile: entryFile, entryFile: entryFile,
dev: this._getBoolOptionFromQuery(urlObj.query, 'dev', true), dev,
minify: this._getBoolOptionFromQuery(urlObj.query, 'minify', false), minify,
hot: this._getBoolOptionFromQuery(urlObj.query, 'hot', false), hot: this._getBoolOptionFromQuery(urlObj.query, 'hot', false),
runModule: this._getBoolOptionFromQuery(urlObj.query, 'runModule', true), runModule: this._getBoolOptionFromQuery(urlObj.query, 'runModule', true),
inlineSourceMap: this._getBoolOptionFromQuery( inlineSourceMap: this._getBoolOptionFromQuery(
@ -944,7 +946,7 @@ class Server {
'entryModuleOnly', 'entryModuleOnly',
false, false,
), ),
generateSourceMaps: this._getBoolOptionFromQuery(urlObj.query, 'babelSourcemap', false), generateSourceMaps: minify || !dev || this._getBoolOptionFromQuery(urlObj.query, 'babelSourcemap', false),
assetPlugins, assetPlugins,
}; };
} }