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

[Packager] can't resolve sha.js dependency (or any other with "." in name) #1055

Closed
mvayngrib opened this issue Apr 28, 2015 · 8 comments
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@mvayngrib
Copy link
Contributor

sha.js, bn.js, dns.js all result in errors like:

Requiring module "testdot/index.ios" with unresolved dependencies: testdot/index.ios is waiting for sha.js/index
sha.js/index is not defined

@christopherdro
Copy link
Contributor

@mvayngrib did you ever get this resolved?

@mvayngrib
Copy link
Contributor Author

yea, sadly I didn't have time to dig in too deep so i hacked https://github.com/facebook/react-native/blob/master/packager/react-packager/src/DependencyResolver/haste/DependencyGraph/index.js#L121

from

var id = sansExtJs(name);

to

var id = name;

and everything worked

@ide ide added the packager label May 29, 2015
@christopherdro
Copy link
Contributor

@mvayngrib How were you originally defining the requirements? Would you be able to provide an example project where this error occurs. That would help out a lot.

@mvayngrib
Copy link
Contributor Author

here's a sample project: https://github.com/mvayngrib/breakdotdep

all i did was:

react-native init breakdotdep
cd breakdotdep
npm install --save hash.js
open breakdotdep.xcodeproj

in index.ios.js add

var hashjs = require('hash.js')

then hit Run and open Chrome Dev Tools and see:

index.ios.bundle:931 Error: 
 stack: Error: Requiring module "breakdotdep/index.ios" with unresolved dependencies: breakdotdep/index.ios is waiting for hash.js/lib/hash
hash.js/lib/hash is not defined
    at Error (native)
    at new ModuleError (http://localhost:8081/index.ios.bundle:107:18)
    at require (http://localhost:8081/index.ios.bundle:214:13)
    at Object.ErrorUtils.applyWithGuard (http://localhost:8081/index.ios.bundle:885:20)
    at require (http://localhost:8081/index.ios.bundle:196:25)
    at http://localhost:8081/index.ios.bundle:41408:2
 line: undefined
 message: Requiring module "breakdotdep/index.ios" with unresolved dependencies: breakdotdep/index.ios is waiting for hash.js/lib/hash
hash.js/lib/hash is not defined ModuleError

@brentvatne brentvatne changed the title can't resolve sha.js dependency (or any other with "." in name) [Packager] can't resolve sha.js dependency (or any other with "." in name) May 30, 2015
@amasad
Copy link
Contributor

amasad commented Jun 3, 2015

Fixed this internally, should go out in the next sync. Sorry for the delay.

@mvayngrib
Copy link
Contributor Author

awesome!

@venocl
Copy link

venocl commented Jun 17, 2015

Hi, I have the same problem with ddp.js even after applying the fix

vjeux pushed a commit to vjeux/react-native that referenced this issue Jun 23, 2015
…d, fix bugs etc)

Summary:
@public
Fixes facebook#773, facebook#1055
The resolver was getting a bit unwieldy because a lot has changed since the initial writing (porting node-haste).
This also splits up a large complex file into the following:

* Makes use of classes: Module, AssetModule, Package, and AssetModule_DEPRECATED (`image!` modules)
* DependencyGraph is lazy for everything that isn't haste modules and packages (need to read ahead of time)
* Lazy makes it fast, easier to reason about, and easier to add new loaders
* Has a centralized filesystem wrapper: fast-fs (ffs)
* ffs is async and lazy for any read operation and sync for directory/file lookup which makes it fast
* we can easily drop in different adapters for ffs to be able to build up the tree: watchman, git ls-files, etc
* use es6 for classes and easier to read promise-based code

Follow up diffs will include:
* Using new types (Module, AssetModule etc) in the rest of the codebase (currently we convert to plain object which is a bit of a hack)
* using watchman to build up the fs
* some caching at the object creation level (we are recreating Modules and Packages many times, we can cache them)
* A plugin system for loaders (e.g. @tadeuzagallo wants to add a native module loader)

Test Plan:
* ./runJestTests.sh react-packager
* ./runJestTests.sh PackagerIntegration
* Export open source and run the e2e test
* reset cache
* ./fbrnios.sh run and click around
@amasad
Copy link
Contributor

amasad commented Jun 30, 2015

@venocl This for sure works in the latest version 0.7.0-rc.2 I just installed ddp.js and double checked.

@amasad amasad closed this as completed Jun 30, 2015
@facebook facebook locked as resolved and limited conversation to collaborators Jun 30, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 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

6 participants