Force react native in dev mode to reload specific file without resetting all cache

I have a file with a piece of code which depends on environment variable (babel transforms it via transform-inline-environment-variables). So if I run something like ENV_VAR="this" yarn start it is set to "this" in that file, but if I re-run ENV_VAR="that" yarn start react native doesn't pick up the change. I have to re-run with --reset-cache option or do some modification to this file manually, for example add console.log. Reset cache take long to rebuild everything and doing manual change looks a bit stupid for me.

Any idea if I can force react native to rebuild this file?

Read more here:

Content Attribution

This content was originally published by Dmitry Volkov at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: