mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-07 22:40:55 +08:00
Sourcemaps support for RAM
Summary:This rev adds support for production sourcemaps on RAM. When we inject a module into JSC we use the original `sourceURL` and specify the `startingLineNumber` of the module relative to a "regular" bundle. By doing so, when an error is thrown, JSC will include the provided `sourceURL` as the filename and will use the indicated `startingLineNumber` to figure out on which line the error actually occurred. To make things a bit simpler and avoid having to deal with columns, we tweak the generated bundle so that each module starts on a new line. Since we cannot assure that each module's code will be on a single line as the minifier might break it on multiple (UglifyJS does so due to a bug on old versions of Chrome), we include on the index the line number that should be used when invoking `JSEvaluateScript`. Since the module length was not being used we replaced the placeholder we have there for the line number. Reviewed By: javache Differential Revision: D2997520 fb-gh-sync-id: 3243a489cbb5b48a963f4ccdd98ba63b30f53f3f shipit-source-id: 3243a489cbb5b48a963f4ccdd98ba63b30f53f3f
This commit is contained in:
committed by
Facebook Github Bot 8
parent
7338c5704e
commit
f99468de65
@@ -16,7 +16,7 @@ function writeSourcemap(fileName, contents, log) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
log('Writing sourcemap output to:', fileName);
|
||||
const writeMap = writeFile(fileName, '', null);
|
||||
const writeMap = writeFile(fileName, contents, null);
|
||||
writeMap.then(() => log('Done writing sourcemap output'));
|
||||
return writeMap;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user