diff --git a/local-cli/bundle/buildBundle.js b/local-cli/bundle/buildBundle.js index a1ac7c7d1df8cd..26a1d386f02489 100644 --- a/local-cli/bundle/buildBundle.js +++ b/local-cli/bundle/buildBundle.js @@ -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, diff --git a/local-cli/bundle/bundleCommandLineArgs.js b/local-cli/bundle/bundleCommandLineArgs.js index 40f6c42ad279bb..15d47de6de28ef 100644 --- a/local-cli/bundle/bundleCommandLineArgs.js +++ b/local-cli/bundle/bundleCommandLineArgs.js @@ -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', diff --git a/local-cli/bundle/types.flow.js b/local-cli/bundle/types.flow.js index 1933a7e71f5e40..714c797978e8d6 100644 --- a/local-cli/bundle/types.flow.js +++ b/local-cli/bundle/types.flow.js @@ -37,6 +37,7 @@ export type OutputOptions = { platform: string, sourcemapOutput?: string, sourcemapSourcesRoot?: string, + sourcemapUseAbsolutePath?: boolean, }; export type RequestOptions = {|