sodium
sodium copied to clipboard
error: Uncaught (in promise) ReferenceError: __dirname is not defined
Error Description
error: Uncaught (in promise) ReferenceError: __dirname is not defined
at Object.g.ready.r.useBackupModule (https://deno.land/x/[email protected]/dist/browsers/sodium.js:1:943)
at https://deno.land/x/[email protected]/dist/browsers/sodium.js:1:497208
Quick finding with Orama Ai on Deno docs
const __filename = new URL(import.meta.url).pathname;
const __dirname = __filename.substring(0, __filename.lastIndexOf('/'));
According to https://docs.deno.com/runtime/fundamentals/node/
We should just have to replace:
__filenamewithimport.meta.filename__dirnamewithimport.meta.dirname
Tried doing it myself but I can't figure out how to build the project to prove it works...
Pretty sure it's all that's needed. Did the same with another library with the same issue and it worked.
Sounds like the solution! You are very welcome to create a PR :)
How to solve this problem?
I'm working on a fix. Gonna take a bit of time...
You can temp fix it by staying on deno 1.x
Any update?