Created
September 13, 2017 00:28
-
-
Save petterik/8ac28e0bd742a954ae9f27c3f5054c7a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash -eux | |
# Original by Austin Birch in http://austinbirch.co.uk/clojurescript-react-native-bundling-release.html | |
# updated for metro-bundler 0.9.0 | |
# prevent metro-bundler applying code folding to our cljs output | |
sed -i .bak \ | |
's/(options.minify)/(options.minify \&\& !filename.match(\/release\\.ios\\.js\/))/' \ | |
./node_modules/metro-bundler/src/JSTransformer/worker/index.js | |
minify_js=./node_modules/metro-bundler/src/JSTransformer/worker/minify.js | |
cp "$minify_js" "$minify_js.bak" | |
perl -0777 -pi.bak -e 's/function withSourceMap(.*\ncode,.*\nsourceMap,.*\nfilename).*\n{/function withSourceMap(code, sourceMap, filename) { if (filename.match(\/release\\.ios\\.js\/)) { return { code: code, map }; }/' \ | |
"$minify_js" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment