Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

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

default discord avatar
dushybag2 years ago
1

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?



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

  • discord user avatar
    dribbens
    2 years ago

    That is a good idea for a docs improvement. Aliasing webpack modules is a pain point so anything we can do to make this better is welcomed!

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.