Skip to content

Conversation

@sailor
Copy link

@sailor sailor commented Jan 7, 2021

Related to the work started here #21, this PR aims at reducing the boot time on big react applications (~1000 files).

For large projects, we can encounter R10 errors because the time spent trying to inject the environment variables on runtime can exceed the default timeout of 60 seconds.

This patch is reducing the amount of files pass to the ruby runtime (which is kind of slow), by greping first all the files containing the REACT_APP_VARS_AS_JSON (in bash). Only the files will be passed to the injectable_env.rb script.

On my local machine i get the following result with the patch:

time .profile.d/inject_react_app_env.sh
.profile.d/inject_react_app_env.sh  1.87s user 0.16s system 82% cpu 2.454 total

And without:

time .profile.d/inject_react_app_env.sh
.profile.d/inject_react_app_env.sh  13.07s user 6.86s system 90% cpu 22.003 total

which can be of a huge help for big apps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant