-
This problem may not for Payload CMS. However, I want to use 'basic-ftp' library for connecting ftp client in payload. But when I am trying to import the library, it gives me the following error.
It seems like a problem with webpack config. I found a lot of solutions, but nothing seems to work for me. Can anyone, how can I use 'basic-ftp' in payload cms? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @aljubaer — This is actually a common problem that has to do with importing non browser-friendly code into browser apps. As the Payload config is shared between the server and the browser, installing server-only modules like But - fixing it is easy! See here in the docs: Also, I've written up a bit longer of a response to this type of issue in another discussion here: Does this help? |
Beta Was this translation helpful? Give feedback.
Hey @aljubaer —
This is actually a common problem that has to do with importing non browser-friendly code into browser apps. As the Payload config is shared between the server and the browser, installing server-only modules like
basic-ftp
will allow the server to work fine, but cause the browser bundle to break.But - fixing it is easy! See here in the docs:
https://payloadcms.com/docs/admin/webpack#aliasing-server-only-modules
Also, I've written up a bit longer of a response to this type of issue in another discussion here:
#205
Does this help?