Skip to content

example quirk: issue with adding dependencies to the library root #308

Open
@brody4hire

Description

@brody4hire

updated:

If a developer uses Yarn to add any dependencies to the library root (not the example), the resulting library root node_modules would cause the example app to crash.

Recommended workaround solutions:

  • always stop Metro if running and remove node_modules from the library root after adding library dependencies and before running the example (it may be required to do yarn in the example to update the node_modules there)
  • consider manually adding any library root dependencies to the library root peerDependencies and devDependencies then using Yarn to add such dependencies to the example itself

This issue was originally reported on the interactive CLI tool in brody4hire/react-native-module-init#42.

original description If I would create a library module with an example, run the example, add a dependency such a `prop-types` to the library root (not the example), and then try running again, then the app will crash. I think the bundler will show some error output at this point.

The workaround is to remove node_modules from the library root, restart Metro, then reinstall and restart the app.

I think this issue needs to be documented and investigated further.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions