xmtp / xmtp-js

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

Bug: Module not found #518

Closed emmajane1313 closed 9 months ago

emmajane1313 commented 10 months ago

Describe the bug

I reported an issue the other day around this and the was a version update to the sdk but there is now another error that its impeding the project from compiling/building, using the latest versions of both packages:

"@xmtp/react-sdk": "4.0.0",
"@xmtp/xmtp-js": "11.3.4",

unhandledRejection node_modules/@xmtp/xmtp-js/dist/index.js:7
import { keccak256 } from 'js-sha3';
         ^^^^^^^^^
SyntaxError: Named export 'keccak256' not found. The requested module 'js-sha3' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'js-sha3';
const { keccak256 } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15) {
  type: 'SyntaxError'
}
   Collecting page data  .%   

Expected behavior

No response

Steps to reproduce the bug

No response

jrh3k5 commented 9 months ago

I can reproduce this issue. v11.3.2 works fine, but v11.3.3 and onward seems broken due to this commit bring in the js-sha3 dependency:

https://github.com/xmtp/xmtp-js/commit/4b0c13863a8089657c032e0bf0c0c7ecfeeced2d#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519

emmajane1313 commented 9 months ago

I've tried using below v11.3.3 with 11.3.2 and 11.3.1 and the error still persists.

github-actions[bot] commented 9 months ago

:tada: This issue has been resolved in version 11.3.5 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

nplasterer commented 9 months ago

@emmajane1313 are you still seeing this in the latest 11.3.5 release? Please feel free to reopen if so. Would also love to connect on what you're building! Thanks for the bug report.

emmajane1313 commented 9 months ago

@nplasterer yes working great now! Thanks for the help. Sure, would love to speak more. Integrating XMTP into a bunch of Lens connected applications. Btw, is your grants program currently active?

nplasterer commented 9 months ago

@emmajane1313 Amazing. I'd love to test out any of the things you're working on in lens I'm nplasterer.eth you can DM me there as well. I know we've got plans to bring back the grants program and @petermdenton is in charge of that. Would you be willing to chat with him? You can dm him at petermdenton.eth.

emmajane1313 commented 9 months ago

@nplasterer awesome sounds great, i'll connect with you and peter over there!