Skip to content

Import issue from js-sha3 module #12

@asbjornenge

Description

@asbjornenge

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions