herenicknameH
Denoβ€’2y agoβ€’
3 replies
herenickname

Unexpected behavior while importing npm module

Im trying to use dns2 library in my deno project:
import { Packet } from 'npm:dns2'

And I get this error:
& deno run -A --watch src/index.ts
error: Uncaught SyntaxError: The requested module 'npm:dns2' does not provide an export named 'Packet'


But if I import this library in a different way, then everything works:
import dns from 'npm:dns2'
console.log(dns.Packet)

Output:
[Function: Packet] {
  TYPE: {
...

What am I doing wrong?

Deno v1.44.4
Was this page helpful?