First of all:
what a suprisingly complex field wrapped into a super nice and fast little package. Extremely useful. Love it!
I hope one day i will do something as useful with my life :)
JS is not my main gig, so i get confused at times; please excuse that.
I have the following situation:
Everything runs fine when i run or build it directly via vite. (Node.js v22.20.0, VITE v6.0.9, "three-text": "^0.3.5")
But now i have to run it in a very specific environment:
NW.js v.0.70.0
https://nwjs.io
https://dl.nwjs.io/v0.70.0/nwjs-sdk-v0.70.0-linux-x64.tar.gz
And when i do that i get this error:
Error: Failed to initialize HarfBuzz: ReferenceError: __dirname is not defined
Now since Node v20.11.0 there is a new workaround (or better: a new way) to get the dir:
import.meta.dirname
nodejs/node#48740
So when i change scriptDirectory=__dirname+"/"; on line 4454 of (the line that's >14000 character long) in ./node_modules/three-text/dist/index.js into scriptDirectory=import.meta.dirname+"/"; then it works for me in the nw.js environment and also still works in the browser.
Buuut i'd like to avoid manually "patching" your lib.
What's the best approach here?
Thx! 😚