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-modulesHi, apparently this documentation is for working with JavaScript, but the same thing doesn't work with TypeScript (I'm guessing the final path of the compiled TS file is different?). Is there any documentation for this?
NVM I resolved this. The thing wasn't working with
ts-node
, but when I compiled the project with
tsc
and then run it, it worked
Hi, I can't manage to create an alias or to run it compiling with tsc. I'm new to typescript. How should I create an alias? Documentation is not clear enough for me
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.