mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-12 11:40:33 +08:00
Add --sourcemap-sources-root to RN packager
Reviewed By: davidaurelio Differential Revision: D4357122 fbshipit-source-id: dc19474aa54ea4684a6b1c586a9d1e5da0980327
This commit is contained in:
committed by
Facebook Github Bot
parent
482c73de86
commit
da59258372
@@ -11,6 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
const meta = require('./meta');
|
||||
const relativizeSourceMap = require('../../../packager/react-packager/src/lib/relativizeSourceMap');
|
||||
const writeFile = require('./writeFile');
|
||||
|
||||
import type Bundle from '../../../packager/react-packager/src/Bundler/Bundle';
|
||||
@@ -24,10 +25,11 @@ function buildBundle(packagerClient: Server, requestOptions: RequestOptions) {
|
||||
});
|
||||
}
|
||||
|
||||
function createCodeWithMap(bundle: Bundle, dev: boolean): * {
|
||||
function createCodeWithMap(bundle: Bundle, dev: boolean, sourceMapSourcesRoot?: string): * {
|
||||
const sourceMap = relativizeSourceMap(bundle.getSourceMap({dev}), sourceMapSourcesRoot);
|
||||
return {
|
||||
code: bundle.getSource({dev}),
|
||||
map: JSON.stringify(bundle.getSourceMap({dev})),
|
||||
map: JSON.stringify(sourceMap),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -40,11 +42,12 @@ function saveBundleAndMap(
|
||||
bundleOutput,
|
||||
bundleEncoding: encoding,
|
||||
dev,
|
||||
sourcemapOutput
|
||||
sourcemapOutput,
|
||||
sourcemapSourcesRoot
|
||||
} = options;
|
||||
|
||||
log('start');
|
||||
const codeWithMap = createCodeWithMap(bundle, !!dev);
|
||||
const codeWithMap = createCodeWithMap(bundle, !!dev, sourcemapSourcesRoot);
|
||||
log('finish');
|
||||
|
||||
log('Writing bundle output to:', bundleOutput);
|
||||
|
||||
Reference in New Issue
Block a user