sodium
sodium copied to clipboard
`__dirname` in "browser" code?
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?