Open wooorm opened 2 years ago
Thanks for reporting this @wooorm :) Sorry for the late response -- I looked into this, and apparently, it's just not supported currently:
Here's a snippet for those who are trying to use nodehun with ESM:
import { createRequire } from 'module'
const require = createRequire(import.meta.url)
const Nodehun = require('nodehun')
I'm going to pin this so others can see it :)
Side note: it's cool to see your username pop up from time to time! :)
Seems that the
.node
extension trips up Node when running a file as a module (ESM).To repro on node 12, 14, 16, 17:
in
example.mjs
:Then running
node example.js
yields: