New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-source-maps

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-source-maps

Utilities to easily add support of Source Maps to your React Native project

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
54
decreased by-8.47%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-source-maps

Utilities to easily add support of Source Maps to your React Native project


Usage:
  1. Add sourcemaps generation to your build script (or customize default one)
  ...
  --sourcemap-output "$DEST/main.jsbundle.map"
  1. Initialise at the app start with source map bundle file and other options
import {initSourceMaps} from 'react-native-source-maps';
initSourceMaps({sourceMapBundle: "main.jsbundle.map", collapseInLine: true});
  1. Use it with your logging utilities Example:
const stack = !__DEV__ && await getStackTrace(error);
if (stack) {
    error.stack = stack;
}
log.error({message: 'Error (' + error.message + ')', error});
  1. To caught all uncaught errors in app you can add global error handler:
import log from "../log";
import {getStackTrace} from 'react-native-source-maps';
import ErrorUtils from "ErrorUtils";

(async function initUncaughtErrorHandler() {
	const defaultGlobalHandler = ErrorUtils.getGlobalHandler();

	ErrorUtils.setGlobalHandler(async(error, isFatal) => {
		try {
			if (!__DEV__) {
				error.stack = await getStackTrace(error);
			}
			log.error({message: 'Uncaught error (' + error.message + ')', error, isFatal});
		}
		catch (error) {
			log.error({message: 'Unable to setup global handler', error});
		}

		if (__DEV__ && defaultGlobalHandler) {
			defaultGlobalHandler(error, isFatal);
		}
	});
})();

Keywords

FAQs

Package last updated on 28 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc