Hi everyone, recently i saw some people who wanted to use discord.js in their resources. Unfortunately, FXServer results incompatible with the package, due to a check in discord.js failing, resulting in it trying to run the browser version on node.js, subsequently crashing the entire resource.
I have forked discord.js and modified this check, here so that it will now work with FXServer’s v8 runtime.
Disclaimer:
i am not the original author of the library, i’m releasing this thanks to the license it has been distributed under, which gives me permission to redistribute the library, with the only clause being stating the changes (which i did above). I suggest you too read the license, which can be found over here in its entirety, or if you want, a nice simple tldr is also available here.
but yeah, unfortunately lots of packages have this broken check, which is bad practice even in normal nodejs anyway… and they didnt want to accept my PR because electron declares the variable i’m checking and electron would need to run the browser version… if you or anyone find any other broken packages, contact me, i’d give it a 90% chance that it is because of a broken browser check
Checked it out, request itself doesn’t have any browser check, but it is possible that one of it’s dependencies does. An error log would help clear this up
This results in it trying to find the module all the way back to your root directory. My suspicion is that this is due to the following issue here.
TLDR: node and @types/node typings do not contain a definition for worker_threads. You’d have to create these typings yourself, however I am not proficient enough at Typescript to do it at this time. I’ll look into it tonight.
In other words, it works in regular Node V8 resources, but not when using Typescript (out of the box). This is not something @IceHax can solve.
That is really unfortunate. I am also not familiar with typescript since I’ve always used regular J’s for everything, otherwise I’d have tried to fix this. But yeah at least it works on regular node