#Ignoring server-side by changing the webpack config is working fine in dev, but errors in build.

1 messages · Page 1 of 1 (latest)

hexed lance
#

I'm trying to use opensearch in one of my hooks, and the library does not run in the browser. So I configured webpack to ignore it, following the docs here -

https://payloadcms.com/docs/admin/webpack#aliasing-server-only-modules

Although this works fine in dev (only if I stop using ts-node, albeit with a warning), it doesn't work in production. I get all the errors as if I haven't modified the webpack config at all.

I've tried clearing webpack cache, still doesn't work. What am I doing wrong?

Payload CMS

The Payload admin panel uses Webpack 5 and supports many common functionalities such as SCSS and Typescript out of the box to give you more freedom.

hexed lance
#

Solved: need to ignore the file with both .js and .ts extensions. The tutorial mentions .js only. Happy to send a PR for the docs if this is actually the recommended solution