xmtp / xmtp-js

XMTP client SDKs, content types, and other packages written in TypeScript
https://xmtp.org/docs
211 stars 40 forks source link

Calling XMTP-JS Module Crashes React-native Project After Successful Installation #79

Closed okpoEkpenyong closed 2 years ago

okpoEkpenyong commented 2 years ago

Trying to import the network Client from 'smtp-jx', import { Client } from '@xmtp/xmtp-js',crashes the project with the following error:

Error: While trying to resolve module@xmtp/xmtp-jsfrom file/Users/.../src/screens/Wallet.js. the package/Users/.../node_modules/@xmtp/xmtp-js/package.jsonwas successfully found. However, this package itself specifies amainmodule field that could not be resolved (/Users/.../node_modules/@xmtp/xmtp-js/index`

It appears these references in the package.json are causing the issues:

{ "main": "dist/cjs/src/index.js", "module": "dist/esm/src/index.js", "umd:main": "dist/umd/src/index.js", "types": "dist/types/src/index.d.js", "scripts": { ... } }

My guess is that these referenced paths could not be found in the project, hence the error.

saulmc commented 2 years ago

@okpoEkpenyong This error is related to the module being installed directly from the repo, rather than npm. https://github.com/xmtp/xmtp-js/pull/81 modifies the install script to address the issue.

saulmc commented 2 years ago

Resolved by #81.