Skip to content

Commit

Permalink
Use the absolute path to the sourcemap in the CS bundle
Browse files Browse the repository at this point in the history
Reviewed By: davidaurelio

Differential Revision: D4831377

fbshipit-source-id: b7da81264a65bea1827237cdd34567b29579acd4
  • Loading branch information
johnislarry authored and facebook-github-bot committed Apr 6, 2017
1 parent b210183 commit 6fa8713
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion local-cli/bundle/buildBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ function buildBundle(
// have other choice than defining it as an env variable here.
process.env.NODE_ENV = args.dev ? 'development' : 'production';

let sourceMapUrl = args.sourcemapOutput;
if (sourceMapUrl && !args.sourcemapUseAbsolutePath) {
sourceMapUrl = path.basename(sourceMapUrl);
}

const requestOpts: RequestOptions = {
entryFile: args.entryFile,
sourceMapUrl: args.sourcemapOutput && path.basename(args.sourcemapOutput),
sourceMapUrl,
dev: args.dev,
minify: !args.dev,
platform: args.platform,
Expand Down
4 changes: 4 additions & 0 deletions local-cli/bundle/bundleCommandLineArgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ module.exports = [
}, {
command: '--sourcemap-sources-root [string]',
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]',
description: 'Directory name where to store assets referenced in the bundle',
Expand Down
1 change: 1 addition & 0 deletions local-cli/bundle/types.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export type OutputOptions = {
platform: string,
sourcemapOutput?: string,
sourcemapSourcesRoot?: string,
sourcemapUseAbsolutePath?: boolean,
};

export type RequestOptions = {|
Expand Down

0 comments on commit 6fa8713

Please sign in to comment.