-
Notifications
You must be signed in to change notification settings - Fork 36
Webpack error when adding plugin #49
Comments
Hey @gusfune — so here's a quick description of what's happening. The Payload config itself combines server-only code and browser-only code into one file, which lets us keep everything simple and allows the config to be the single source of truth for how Payload gets built up. But, with that comes the challenges of making sure that server-side code gets excluded within the browser JS bundle. As you mentioned, polyfilling is a potential way to do this. But, this plugin actually takes care of this for you as long as it is initialized properly. If you look at the adapters for each of our supported cloud storage vendors, each one "extends" Payload's webpack config for you so that you don't have to do anything, and the server-side code gets excluded from your bundle automatically. I think this may be a case of not initializing the plugin appropriately, thus it is not successfully adding its aliases to the Webpack config. Can you send me your Payload config code? Are you passing the plugin accurate arguments? |
Thanks for the quick response @jmikrut - seems like the issue was trying to make the configuration "customisable" by making the plugin option, kinda like:
By just adding everything to the config, it compiles. I am closing this, but leave the suggestion to maybe allow disabling the remote storage on local development mode. |
Agreed, @jmikrut is there any guidance on local testing without needing to modify the code? Right now I have to completely remove the
I also tried using the localstack s3 setup but it looks like persistence is a paid feature now. |
I worked around this by always passing the
Not ideal, but it works ¯\_(ツ)_/¯ |
I'm installing this plugin on a fresh install of Payload CMS, but I get the following error when adding to the configuration
I tried to polyfill
fs
withpath-browserify
, but no success. All the configurations are default.Interestingly, it seems to be looking for node_modules inside a node_modules.
Running it on yarn workspace, but, tried to isolate to a non-workspace and same issue happens.
Node 18.19.0
The text was updated successfully, but these errors were encountered: