This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-16
Channels
- # beginners (1)
- # boot (69)
- # carry (1)
- # cider (29)
- # cljs-dev (17)
- # cljsrn (100)
- # clojure (13)
- # clojure-austin (13)
- # clojure-brasil (1)
- # clojure-dev (1)
- # clojure-korea (3)
- # clojure-russia (3)
- # clojure-spec (20)
- # clojure-uk (5)
- # clojurescript (45)
- # cloverage (3)
- # datomic (5)
- # figwheel (1)
- # hoplon (198)
- # klipse (25)
- # lein-figwheel (2)
- # leiningen (3)
- # off-topic (35)
- # om (7)
- # om-next (2)
- # onyx (8)
- # proton (8)
- # re-frame (3)
- # untangled (1)
- # vim (13)
@levitanong what I do: 1. set max_old_space_size, 2. no advanced compilation on the cljs side and 3. use --dev
in the bundle task
@pesterhazy
1. I’ve been meaning to ask someone: Is it max_old_space_size, or max-old-space-size? 😛
2. By that do you mean :optimizations :none
in project.clj
?
3. Where do i set this? I do see the resultant bundle have —dev true
though...
wait let me check
Because I’ve looked around, and a lot of resources sometimes use _, and sometimes -.
based on the link you provided, it seems you mean use :optimizations :simple
instead of :optimizations :advanced
. My project.clj is already on :simple
. 😞
I am also unsure what to do with the python script 😛 Sorry, pretty new to this, and I’ve never used python before
that's what I use
And i’m assuming that’ll still apply to re-natal?
I think so
Alas, it’s already set to 8192
node_modules/.bin/react-native bundle --help
Options:
--entry-file Path to the root JS file, either absolute or relative to JS root [required]
--platform Either "ios" or "android"
--transformer Specify a custom transformer to be used [default: null]
--dev If false, warnings are disabled and the bundle is minified [default: true]
if you set --dev true
, the bundler will skip whole program optimization
that reduces the mem requirement
Ah, so in the project.pbxproj (apparently this is how re-natal does it)
"export NODE_BINARY='node --max_old_space_size=8192'\n../node_modules/react-native/packager/react-native-xcode.sh”
would be
"export NODE_BINARY='node --max_old_space_size=8192 —dev true'\n../node_modules/react-native/packager/react-native-xcode.sh”
it also adds __DEV__=true;
to the top of the file ,which you don't want for prod builds
hence the python script
oh it’s a regex string replace
have a look at the react-native-xcode.sh shell script
it takes a DEV variable
you'll need to adapt that
I don't use that script and instead build the bundle.js myself
Isn’t dev true by default though?
yes but I guess not for release builds?
DEV__=true gives you yellow boxes and worse perf
oddly enough, it seems re-natal spits out —dev true even for prod builds
I noticed your comment on one of the issues in react-native… something about child processes not inheriting the memory allocation. Could that be it?
yes I think so
I couldn't get to the bottom of how this works on node though
it's not really an ecosystem built for mem-intensive tasks
GC options are hardly even documented
Oh dear, that sounds like the root of the problem won’t be fixed anytime soon
my experience is that packager problems that don't affect the FB team don't get any attention
none of my issues have prompted a response so far
the packager is a true weakness of RN, which is sound engineering otherwise
@levitanong I'm sure you can make it work though. Try running the packager manually
the trouble with neatly packaged solutions like re-natal is that it's hard to peak under the covers
try to find the cljs bundle output and run react-native bundle --dev true
manually
ok, will do that 😄
Yeah, I’d actually prefer to work with boot-react-native, but I figured re-natal was more mature
it might also be an idea reaching out to the node community to find out how to set node cli parameters of subprocesses
Would you say that react-native run-ios
is a combination of react-native bundle
and some other command?
no, it has nothing to do with bundle
it just compiles the objectivec code and launches it in the simulator
it also opens a new terminal window with the command react-native start
if it isn't running yet
that's the packager running as a webserver (which is like a live version of react-native bundle
)
but you can run that manually in a terminal yourself
I’m doing that right now, and I’m seeing a terminal output similar to when "node_modules/react-native/packager/packager.sh —nonPersistent” is run
yeah that's the same thing
npm start
, reat-native start
, packager.sh
is all the same thing
TIL 😆
the RN is packager is weird. Why can't you disable whole-program optimization?
aaaand this just happened:
<--- Last few GCs --->
107608 ms: Mark-sweep 1360.1 (1435.2) -> 1360.1 (1435.2) MB, 2453.1 / 0.0 ms [allocation failure] [GC in old space requested].
110077 ms: Mark-sweep 1360.1 (1435.2) -> 1360.1 (1435.2) MB, 2469.4 / 0.0 ms [allocation failure] [GC in old space requested].
112562 ms: Mark-sweep 1360.1 (1435.2) -> 1363.6 (1419.2) MB, 2484.6 / 0.0 ms [last resort gc].
115055 ms: Mark-sweep 1363.6 (1419.2) -> 1367.1 (1419.2) MB, 2492.4 / 0.0 ms [last resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x76241dcfb51 <JS Object>
1: visitQueue [/Users/levi/repos/load-app/node_modules/babel-traverse/lib/context.js:~114] [pc=0x1ff0c180cb82] (this=0x380393cc8451 <a TraversalContext with map 0x35352b580b11>,queue=0xda0eadf7869 <JS Array[1]>)
2: node [/Users/levi/repos/load-app/node_modules/babel-traverse/lib/index.js:~94] [pc=0x1ff0c1837a82] (this=0x2532e6106309 <JS Function traverse (SharedFunctionInfo 0x3f68fc267ad…
yeah I've seen the issue with babel as well
maybe disable babel flow checks?
I always thought it may have something to do with that
ah, the type checker?
you get the impression that the JS world works (if it does) mostly be accident
😛 I went to clojurescript to escape the madness, but you can never really escape the madness
How would I disable it though? Would I have to dig in to node_modules and change something in there?
The only documentation on babel is {"plugins": ["syntax-flow"]}
in .babelrc
I think there is a .babelrc or something you can add
oh you mentioned that 🙂
Oh, I’m supposed to add it
no I don't know really
so even react-native start
runs out of memory for you?
Well yeah I wouldn’t even know how to indicate the absence of it in the .babelrc
npm start
generally just stays there until i run react-native run-ios
If i’m in the re-natal dev mode, it runs fine
if i’m in the re-natal prod mode, it runs out of memory
I found it curious though, that react-native bundle
ran out of memory before I even did run-ios
so maybe bundle
is slightly different from npm start
so run-ios starts the app
the app makes a request to the web server at localhost something something
that triggers the packaging step
react-native bundle
immediately packages the supplied entry point file
so no surprise that run-ios
is not required
ahhhhh
more TIL
the main issue is that the RN packager doesn't expect the huge cljs-generated bundle we run it on
I never tried to use react-native start
with a dev bundle
didn't know that re-natal did that
In re-natal,
if you want to do dev (with figwheel)
re-natal use-figwheel
npm start
react-native run-ios
;; different terminal lein figwheel ios
if you want to run prod
lein prod-build
npm start
react-native run-ios
edit: moved npm start up
So i’m not sure if the re-natal use-figwheel
thing is a dev bundle
@levitanong please report back if you find a solution
this is something that everyone who puts cljsrn in production will run into
@pesterhazy Haha, I will, though I think it’ll be unlikely that I’ll be the one to find the solution
I'm sure there's a hack waiting to happen
I've patched RN packager before
Anyway, thanks for the help, @pesterhazy! My problem may not be solved, but I learned a lot from you 😄
good luck!
also create an issue on re-natal so people can track the progress
we're all in this together 🙂
Oh, right! will do