Skip to content

Instantly share code, notes, and snippets.

@pesterhazy
Created August 17, 2016 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pesterhazy/d05170f45e10b6916206583f28b21cae to your computer and use it in GitHub Desktop.
Save pesterhazy/d05170f45e10b6916206583f28b21cae to your computer and use it in GitHub Desktop.
Set __DEV__ of RN packager output to false
#!/usr/bin/env python
#
# boot-react-native-no-dev.py
#
# Patch jsbundle to set __DEV__ to false
#
# The React Native packager often cannot handle Google Closure-generated JS files
# if `--dev false` is set, eventually running out of memory. As a workaround,
# use `--dev true` and patch the __DEV__ setting in the output bundle to
# false.
#
# Usage:
#
# python boot-react-native-no-dev.py < bundle.js > output.js
import sys, re
print(re.sub(r'__DEV__\s*=\s*true;', "__DEV__=false;",
sys.stdin.read()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment