Question Details

No question body available.

Tags

node.js next.js discord.js zlib

Answers (1)

April 11, 2025 Score: 1 Rep: 482 Quality: Low Completeness: 50%

After looking into this further, there are two packages that discord.js looks for; zlib-sync and then bufferutil. Next.js uses tree shaking to compile its application and since these are optional its shakes them out which it SHOULD'T do but its also not a big deal since we don't need them in the next.js environment to compile. So I altered my next.config.mjs file to the following

import webpack from 'webpack'

/ @type {import('next').NextConfig} */ const nextConfig = { // ...other code

webpack: (config) => { config.plugins.push( new webpack.IgnorePlugin({ resourceRegExp: /^zlib-sync$/ }), new webpack.IgnorePlugin({ resourceRegExp: /^bufferutil$/ }), ) return config }, }

export default nextConfig

After that, the system compiled fine. Just a pain in the butt to have figured that out.