Source Map Upload¶
Automatic Source Map Packaging¶
Add Automatic Source Map Packaging Script¶
Script tool: react-native-mobile-cli
react-native-mobile-cli is used to automatically fetch React Native and Native sourcemaps during release builds and package them into a zip file.
Add it to the devDependencies of package.json using a local file path.
"devDependencies": {
"@cloudcare/react-native-mobile-cli":"file:./ft-react-native-mobile-cli-v1.0.0.tgz"
}
After adding, run yarn install.
Note: The Android environment requires adding the Gradle Plugin ft-plugin, version
>= 1.3.4.
Add the plugin and parameter settings in the build.gradle file of the project's main module app:
apply plugin: 'ft-plugin'
FTExt {
//showLog = true
autoUploadMap = true
autoUploadNativeDebugSymbol = true
generateSourceMapOnly = true
}
Execute Configuration Command¶
Run yarn ft-cli setup in the React Native project directory to enable automatic fetching of React Native and Native sourcemaps during release builds and package them into a zip file.
➜ example git:(test-cli) ✗ yarn ft-cli setup
yarn run v1.22.22
$ /Users/xxx/example/node_modules/.bin/ft-cli setup
Starting command: Setup to automatically get react-native and native sourcemap in release build and package them as zip files.
Running task: Add a Gradle Script to automatically zip js sourcemap and Android symbols
Running task: Enable react-native sourcemap generation on iOS
Running task: Setup a new build phase in XCode to automatically zip dSYMs files and js sourcemap
Finished running command Setup to automatically get react-native and native sourcemap in release build and package them as zip files.
✅ Successfully executed: Add a Gradle Script to automatically zip js sourcemap and Android symbols.
✅ Successfully executed: Enable react-native sourcemap generation on iOS.
✅ Successfully executed: Setup a new build phase in XCode to automatically zip dSYMs files and js sourcemap.
✨ Done in 1.00s.
Zip file locations after running release build:
- iOS:
./ios/sourcemap.zip - Android:
./sourcemap.zip
Manual Source Map Packaging¶
React Native Zip Package Packaging Guide
Upload¶
After generating the zip file, upload the corresponding SourceMap file via the public DataWay.
For more details, refer to:
If the app publishes JavaScript hot updates via OTA solutions such as CodePush, also refer to Hot Update SourceMap Version Matching to configure and upload the corresponding version of SourceMap for the base package and each hot update package.