A totally fresh project, I assume nextjs and @discordjs/core might be having some conflicts, but I don't find zlib-sync to be a common dep b/w next.js so I don't thing thats a valid reason.
error
- error ./node_modules/@discordjs/ws/dist/index.mjs:522:36
Module not found: Can't resolve 'zlib-sync'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/@discordjs/core/dist/index.mjs
./app/page.tsx
Home Page (and the only page using @discordjs/core)
import { REST } from '@discordjs/rest';
import { API } from '@discordjs/core';
export default async function Home() {
const rest = new REST({ version: '10' })
const api = new API(rest);
const commands = await api.applicationCommands.getGlobalCommands('id')
return (
<main>
{commands.map((command) => { return <div key={command.id}>{command.name}</div> })}
</main>
)
}
npm ls
├── @discordjs/core@0.6.0
├── @types/node@20.3.1
├── @types/react-dom@18.2.6
├── @types/react@18.2.13
├── autoprefixer@10.4.14
├── eslint-config-next@13.4.6
├── eslint@8.43.0
├── next@13.4.6
├── postcss@8.4.24
├── react-dom@18.2.0
├── react@18.2.0
├── tailwindcss@3.3.2
└── typescript@5.1.3
Minimum reproducible code
npx create-next-app@latest
the image has the options setted while configuring the next-app
npm i @discordjs/core
paste this in /app/page.tsx
import { REST } from '@discordjs/rest';
import { API } from '@discordjs/core';
export default async function Home() {
const rest = new REST({ version: '10' })
const api = new API(rest);
const commands = await api.applicationCommands.getGlobalCommands('id')
return (
<main>
{commands.map((command) => { return <div key={command.id}>{command.name}</div> })}
</main>
)
}