When building my project, an ESM error is thrown because of Sendbird

Hi everyone. I recently tried to build my project on a test server and it builds successfully. However, when I start the application and try to load the page, I receive the following error:

Error [ERR_REQUIRE_ESM]: require() of ES Module /node_modules/@sendbird/chat/sendbird.js from /build/node/main.5132a43a.js not supported.
Instead change the require of sendbird.js in /build/node/main.5132a43a.js to a dynamic import() which is available in all CommonJS modules.

I know this has to do with the @sendbird package being a module, but I can’t figure out how to solve it. Any help is appreciated

For anyone wondering, the reason this was happening is because I was using a fork of create-react-app that was using webpack-node-externals, which caused webpack to ignore bundling all packages in node_modules. As a temporary solution I have removed this and it has fixed the issue.