-
Notifications
You must be signed in to change notification settings - Fork 22
Avoiding Metro timeouts
Metro transforms your JS (your compiled ClojureScript) using babel. This process is terribly slow. If you run into issues with the transformation timing out, as shown by the following error message, then you have a couple of choices for what to do:
Error: TimeoutError: transforming .../index.android.js took longer than 301 seconds.
If you have some dependencies using newer JS features which will need to be transformed by babel, you'll need to patch metro. If you don't then you can use re-natal-husk to work around the issue entirely.
For those who do need transformation, due to some dependencies using fancy JS features, there's a quick patch. The patch, which you can add as part of your build script, is to have metro wait longer than 5 minutes to transform. You can specify any value, in seconds, you want here, but this should be sufficient even for large applications.
metro=../node_modules/metro-bundler/src/JSTransformer/index.js
sed -i 's/\(TRANSFORM_TIMEOUT_INTERVAL\) = .*;/\1 = 901000;/g' "$metro" || true
A relevant Metro ticket for this is here: https://github.com/facebook/metro/issues/111