Importing files outside main directory
See original GitHub issueWhere I have a directory for mobile and a directory for web which I’d like to share some common code (utils, etc). Currently, if I import a file outside the root directory of my generated app (outside where App.js
is located), I get an error with no file found.
Is this by design? Will this be supported in the future and is this an Expo limitation or RN?
Thanks
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:22 (4 by maintainers)
Top Results From Across the Web
Python - Import module outside directory
If the module exists in the same directory as the file, we can directly import it using the syntax import module_name. But if...
Read more >How to access a module from outside your file folder in ...
The simplest way is to modify the sys.path variable (it defines the import search path): # Bring your packages onto the path import...
Read more >How to import files from outside of root directory with React ...
So we're going to see how to directly reference any file outside of root directory.. Consider this example: common - components - Utils.ts,...
Read more >Python File Importation into Multi-Level Directory Modules ...
Let's use a Python project with a directory structure (as shown below) to demonstrate how easy it can be to import from a...
Read more >Python — How to Import Modules From Another Folder?
The most Pythonic way to import a module from another folder is to place an empty file named __init__.py into that folder and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@pankaj-arunsingh I can’t find the original issue where I finally found this but basically add only the external module path you want to import. In my case my module had a dependency on React and React-Native so those are added as extraNodeModules. Hope this helps.
Inside
rn-cli.config.js
:This is crazy. Please post a solution to this problem if anyone finds it.