paulmillr / noble-hashes

Audited & minimal JS implementation of hash functions, MACs and KDFs.
https://paulmillr.com/noble
MIT License
545 stars 46 forks source link

".js" imports are causing issues in Deno #58

Closed quentinadam closed 1 year ago

quentinadam commented 1 year ago

For example, I am trying to use the blake2b hash in Deno by importing the following:

import { blake2b } from 'https://deno.land/x/hashes@1.3.0/blake2b.ts';

But I am getting the following issue:

error: Module not found "https://deno.land/x/hashes@1.3.0/_blake2.js".
    at https://deno.land/x/hashes@1.3.0/blake2b.ts:1:42

Changing the import statements on the first lines of blake2b.ts to use the ".ts" extension instead of ".js" would solve the issue.

paulmillr commented 1 year ago

Changing the import statements to .ts will make the library fail in other environments, which are pure js.

As mentioned in README, for deno, use it with NPM specifier instead: https://github.com/paulmillr/noble-hashes#usage

quentinadam commented 1 year ago

Makes sense, thanks for clarifying.