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

Import issue from js-sha3 module #12

Open
asbjornenge opened this issue Nov 29, 2024 · 0 comments · May be fixed by #13
Open

Import issue from js-sha3 module #12

asbjornenge opened this issue Nov 29, 2024 · 0 comments · May be fixed by #13

Comments

@asbjornenge
Copy link

asbjornenge commented Nov 29, 2024

I'm using this module in my https://github.com/asbjornenge/onchfs-cli package. Or, I would like to, but I had to build a custom version because of this error when consuming the module:

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;

Fixing that import statement in the dist/index.mjs fixed my issue. For now I just packed it with my module, but would be nice to get this fixed and comsume it correctly.

@asbjornenge asbjornenge linked a pull request Dec 1, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant