Cant resolve zlib-sync
When using discordjs/core, I get the following error message
Not sure whats going on
26 Replies
these are the deps i have
oke seems like not a really discord related
https://bobbyhadz.com/blog/module-not-found-error-cant-resolve-path#module-not-found-cant-resolve-zlib-error
More a "trying to use a nodejs function in the frontend" issue.
so the following throws the error:
this is a server component, so it is not rendered on the clientside?
when it says its a node function, does it need to be in an api route to work?
Use
@discordjs/core/http-only
oh
install this package? or import it when importing API from core?
Also, you want to... share
rest
and api
as a singleton somewhere
If you create new instances over and over, you won't have ratelimits
Importyea, ill create a util class for this
It's a subpath
You don't need a util class for this
You'd be wrapping an util class with an util class
Use
moduleResolution: 'bundler'
in your TS configwhat does this do?
Respect the
exports
from package.json
Similar to node16
and nodenext
, but more suited for webhttps://github.com/BirthdayyBot/dashboard/blob/b81b815637747d20bb5e4f031d73785c303126f4/tsconfig.json\
this is it currently btw
https://github.com/BirthdayyBot/dashboard/blob/9032afd183492cf738d71da011d1724f7efce8e3/package.json and this the package.json, if you find any other things that should get improved
Yeah, exactly what I said, set that
now the import works
but it still runs into the zlib issue
It shouldn't
https://github.com/BirthdayyBot/dashboard/blob/develop/src/app/(dashboard)/guild/%5BguildId%5D/page.tsx
thats the page btw, maybe anything else that could cause this?
oh bruh
restarting vscode always helps lmfao
tysm, ur awesome
what is the difference when deploying on vercel?
https://vercel.com/birthdayy/birthdayy-dashboard/5Qxypnw9j6BBTsV5zT3FZG492dWH (nvm you cannot see this)
Cause vercel still fails to find the zlib lmao
reproducable when using yarn build locally
What if you install dev? 🤔
okay im just to stupid sometimes, sorry
theonly issue now, is that i want to import discord.js in another place to use the permission bitfield
You can use
@sapphire/bitfield
and as far as I understood it imports discord.js ws
ah
Hence why
@discordjs/core/http-only
can I create a bitfield from a number there?
Read the docs
its expecting a Record
on it
Docs = README
Yeah, just pass
PermissionsFlagBits
Then reuse it as your PermissionsBitField
objecti don't follow
my brain is not functional rn, im sorry haha
think imma take a break, this cant be that complicated