Hi everyone. I'm super hyped to give Payload a try!
I would however love to integrate it with my Clojurscript web server, which runs on Node.js and has it's own configuration mechanism. One solution would be to read some configuration (for the DB) from a file. I have tried requiring Node's
module in the
const fs = require('fs');
This makes webpack frontend build fail, which obviously can't access the node module:
Module not found: Error: Can't resolve 'fs' in '…/df-macchiato/server'
The config I want to read is purely for the server. Is there a way tu suppress the require for the frontend build?
If this is not the case, it would also be possible (even better!) if I had a way to pass the server config during the call to
. My attempts at this, however, ran into the converse problem: I cannot require the slate Editor inside Node.js because it requires SCSS, which is only possible in webpack:
…/node_modules/payload/dist/admin/components/elements/Banner/index.scss:1 @import '../../../scss/styles.scss';
I'm a bit lost at this point and would appreciate any directions you can give me.
Alright, I think I'm getting somewhere. It seems I can supply the server-only parts of the config directly to the init method. The frontend-only parts go into my payload.config.js. Shared parts (e. g. collections) f
go into some third file that I can require in both to avoid duplication. Is that how it's supposed to be done?
I think I have found the correct way of doing things here, so I'm going to mark the issue resolved.
@euporos Could you please point out how you managed to get it working?
nvm, I managed to get it working as well. It was a misconfiguration with the media collection I had previously created. Thanks!