Bug for devs with monorepos + expo bare workflow

Options

Hey everyone,

I'm just posting this here in case it could be helpful for daily's docs as I had this issue and it took me about 2 days to figure it out.


It seems Daily react-native js is not compatible with metro's option to disable hierarchical lookup. Line in metro.config.js would be: `config.resolver.disableHierarchicalLookup = true`


For SEO, the issue looks something like this:

TypeError: undefined is not an object (evaluating

\'_$$_REQUIRE(_dependencyMap[8], "event-target-shim").defineCustomEventTarget.apply\')'


Seems to be working now, so hopefully this helps someone!

Tagged:

Answers

  • filipi
    filipi Dailynista
    Options

    Hi @joshrozin ,


    Thank you for sharing this.


    I was investigating this issue a bit more, and when we disable the hierarchical lookup, the metro server stops to look for the internal dependencies.


    Like, this is the default behavior:

    https://facebook.github.io/metro/docs/resolution/#disableHierarchicalLookup-boolean

    If context.disableHierarchicalLookup is not true:

    - Try resolving moduleName under node_modules from the current directory (i.e. parent of context.originModulePath) up to the root directory.

    - Perform the algorithm for resolving a path (step 2 above) for each candidate path.


    What is happening in this case, is that both react-native and react-native-webrtc depend on different versions of event-target-shim. So if after the install you look into node_modules/@daily-co/react-native-webrtc/node_modules, you will see that there is a dependency of event-target-shim which is different from the one that is inside node_modules/event-target-shim.

    And since when we disable the hierarchical lookup, the metro server stops to look for the internal dependencies, I believe that is the origin of the error.

    Again, thanks a lot for sharing this, I will create a task to see if we can somehow manage to make It work, otherwise as you have suggested add It explicitly to our docs.