lmdb-js
lmdb-js copied to clipboard
Unable to import package in Deno: Module not found ./external.js error
When importing in Deno (no actual usage) the following error occurs:
error: Module not found "https://deno.land/x/[email protected]/external.js".
at https://deno.land/x/[email protected]/deps.ts:2:30
Most likely, importing setExternals
from ./native.js
instead of ./external.js
in deps.ts will fix it
Using deno 1.22.2
Presently you have to use [email protected] for Deno support. In v2.3, lmdb-js switched to using NAPI, because the Deno devs indicated that would be the future native interface. Unfortunately the PR for NAPI is still unmerged, so you will have to stick with v2.2.x until the NAPI support lands in Deno.
Hi, thanks for the response. I will try 2.2
Anyway, regardless of compatibility with Deno API, the current issue is about importing, not actual usage.
Its a leftover of https://github.com/kriszyp/lmdb-js/commit/4d6371dc6faaa69f2a1a43d980ace0f328c89106 . Forgot to rename external.js to native.js
Yes, that's true, but that issue is due to abandonment of deps.ts :). But its a good point, and I will clean that up.
hi @kriszyp the FFI interface got considerable performance improvements in recent releases. While Node-API is still planned to land in Deno - it won't be as fast. Here are some benchmark results comparing 1.22 and 1.24.3 -
Source: https://github.com/littledivy/lmdb-js/commit/9317f4cb9b08c1064fe535a267561b474eb254e2
cpu: Apple M1
runtime: deno 1.22.0 (aarch64-apple-darwin)
file:///Users/divy/gh/lmdb-js/benchmark/deno.ts
benchmark time (avg) (min … max) p75 p99 p995
----------------------------------------------------- -----------------------------
getBinaryFast 785.18 ns/iter (729.11 ns … 2.41 µs) 742.38 ns 2.41 µs 2.41 µs
setData 1.41 ms/iter (57.29 µs … 14.29 ms) 1.32 ms 11.38 ms 13.41 ms
getData 1.2 µs/iter (958 ns … 1.25 ms) 1.12 µs 2.83 µs 3.75 µs
cpu: Apple M1
runtime: deno 1.24.3 (aarch64-apple-darwin)
file:///Users/divy/gh/lmdb-js/benchmark/deno.ts
benchmark time (avg) (min … max) p75 p99 p995
----------------------------------------------------- -----------------------------
getBinaryFast 117.1 ns/iter (92.73 ns … 939.55 ns) 138.7 ns 212.55 ns 252.8 ns
setData 1.38 ms/iter (58.17 µs … 11.03 ms) 1.39 ms 5.31 ms 7.83 ms
getData 423.32 ns/iter (383.97 ns … 1.76 µs) 395.32 ns 994.77 ns 1.76 µs
nonblocking calls aren't using the optimized path at the moment but that is planned.