I'm using the Next.js starter template and trying to make API calls using afterChange hook to third party services using their SDK, but that results in 100s of the following exception.
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
It works normally on the Next.js side though. Any idea on how to resolve this? StackOverflow answers do not work for me as none talks about 100s of exception at the same time.
Your hook is likely pulling in a library for server-only code. You'll need to alias that code. Documentation here:https://payloadcms.com/docs/admin/webpack#aliasing-server-only-modules
NVM I resolved this. The thing wasn't working with
, but when I compiled the project with
and then run it, it worked
Get help straight from the Payload team with an Enterprise License.