Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Packger] Importing from parent directory of react-native root #13990

Closed
yugalbagul opened this issue May 16, 2017 · 1 comment
Closed

[Packger] Importing from parent directory of react-native root #13990

yugalbagul opened this issue May 16, 2017 · 1 comment
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@yugalbagul
Copy link

yugalbagul commented May 16, 2017

I am trying to share code between my web and mobile. I have gone through this thread/issue which is same as mine.

Unfortunately @dutzi's solution does not seem to work with react-native@0.44.0.

Also this post here says it is not allowed to fetch from outside of your React Native Project root.

I have followed this medium article and other such sources which suggest similar way.

Stack overflow question for the same.

I am running -
"react": "16.0.0-alpha.6", "react-native": "0.44.0",

Folder Structure

  -- parent
    -- package.json {"name":'parent'}
    -- mobile
      -- app
        -- modules
          -- login
            -- Login (import { loginAPi } from 'parent/src/data/api')
    -- src
      -- package.json {"name": "source"}
    -- data
      -- package.json {"name": "data"}
      -- api
        -- package.json ({"name":"api"})
        -- index.js

packager console:

error: bundling: UnableToResolveError: Unable to resolve module `parent/src/js/data/api` from `/Users/../../../../mobile/app/modules/login/Login.js`: 
Module does not exist in the module map or in these directories:
/Users/../../../parent/mobile/node_modules/parent/src/js/data
/Users/../../../parent/node_modules/parent/src/js/data
/Users/../../../node_modules/parent/src/js/data

NOTE- Web application which is in src has been already developed and has considerable code, and the team is just starting with the react-native set up. We want to use the data part of the web application in the mobile.

Need help getting things right.

@skevy
Copy link
Contributor

skevy commented Jun 8, 2017

Hi there!

The packager no longer lives in this repo. It now lives in https://github.com/facebook/metro-bundler. The reasoning for the split is explained here: #13976.

If you're still interested in pursuing this issue, please open an issue on that repo! :)

Thanks!
-Adam

@skevy skevy closed this as completed Jun 8, 2017
@facebook facebook locked as resolved and limited conversation to collaborators Jun 8, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants