FileSystem to find expo javascript files

Hi Guys,

I’m conditionally loading .js files in my expo project - meaning if the javascript file exists at compile time I’ll load them.
I’m using FileSystem to establish if a file exists, but it’s not working.
This is my code:

  .then(success =>console.log('success', success))
  .catch(error => console.log('error', error))

but I keep getting the following error when I try to establish if the file exists.

error […/’ isn’t readable.]

Hi @kashifceler. The FileSystem API is for files on the device, not source files. In addition, all your source files are bundled up into a single file when you publish, so I can’t think of a case where this would give you any useful information even if it was possible. Can you explain why you’re trying to do this?

Hi Jesse,

Thanks for your reply. If the client_override directory exists I want to take the files from it and replace the default client directory files. In nodeJS I did this using the fs library - where I checked if the the directory existed, obviously fs can’t be used in react-native.

Thanks again.

Ok, you won’t be able to use that same strategy but there are a bunch of approaches that would work. Still don’t understand exactly why you’re trying to do that. Seems like you could just replace the files in the client directory instead of using an additional directory?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.