I have created a server action like this:
/// /lib/actions.ts
"use server";
import { Client } from "discord.js";
export async function create(formData: FormData) {
const discordClient = new Client({
intents: ["GuildMessages", "Guilds"],
});
}
And then I have a simple form in a page that uses this action:
<form action={create} >
/// some elements
</form>
However, everytime I build, I get this error:
Module not found: Can't resolve 'zlib-sync'
I tried commenting each line, and when I comment Discord Client, the error goes away.
I think webpack is trying to include discordjs in the client-side (which it shouldn't).
How can I solve this issue?