Use the absolute path to the sourcemap in the CS bundle

Reviewed By: davidaurelio

Differential Revision: D4831377

fbshipit-source-id: b7da81264a65bea1827237cdd34567b29579acd4
This commit is contained in:
Max Sherman 2017-04-06 09:21:38 -07:00 committed by Facebook Github Bot
parent b2101836dc
commit 6fa87134fc
3 changed files with 11 additions and 1 deletions

View File

@ -46,9 +46,14 @@ function buildBundle(
// have other choice than defining it as an env variable here. // have other choice than defining it as an env variable here.
process.env.NODE_ENV = args.dev ? 'development' : 'production'; process.env.NODE_ENV = args.dev ? 'development' : 'production';
let sourceMapUrl = args.sourcemapOutput;
if (sourceMapUrl && !args.sourcemapUseAbsolutePath) {
sourceMapUrl = path.basename(sourceMapUrl);
}
const requestOpts: RequestOptions = { const requestOpts: RequestOptions = {
entryFile: args.entryFile, entryFile: args.entryFile,
sourceMapUrl: args.sourcemapOutput && path.basename(args.sourcemapOutput), sourceMapUrl,
dev: args.dev, dev: args.dev,
minify: !args.dev, minify: !args.dev,
platform: args.platform, platform: args.platform,

View File

@ -37,6 +37,10 @@ module.exports = [
}, { }, {
command: '--sourcemap-sources-root [string]', command: '--sourcemap-sources-root [string]',
description: 'Path to make sourcemap\'s sources entries relative to, ex. /root/dir', description: 'Path to make sourcemap\'s sources entries relative to, ex. /root/dir',
}, {
command: '--sourcemap-use-absolute-path',
description: 'Report SourceMapURL using its full path',
default: false,
}, { }, {
command: '--assets-dest [string]', command: '--assets-dest [string]',
description: 'Directory name where to store assets referenced in the bundle', description: 'Directory name where to store assets referenced in the bundle',

View File

@ -37,6 +37,7 @@ export type OutputOptions = {
platform: string, platform: string,
sourcemapOutput?: string, sourcemapOutput?: string,
sourcemapSourcesRoot?: string, sourcemapSourcesRoot?: string,
sourcemapUseAbsolutePath?: boolean,
}; };
export type RequestOptions = {| export type RequestOptions = {|