I'm trying to use DNT to try to make my Deno library available in Node. sodium
is one of my dependencies.
After DNT does its thing, it tries to run my tests, but node fails when it sees __dirname
in ESM JS:
ReferenceError: __dirname is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and 'C:\Users\Cody\code\feoblog-client\npm\esm\package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at g.ready.r.useBackupModule (file:///C:/Users/Cody/code/feoblog-client/npm/esm/deps/deno.land/x/[email protected]/dist/browsers/sodium.js:16:452)
at file:///C:/Users/Cody/code/feoblog-client/npm/esm/deps/deno.land/x/[email protected]/dist/browsers/sodium.js:2083:65
dist/browsers/sodium.js contains that variable. Shouldn't a browser build strip out node-specific variables?
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too