So I've ironed out the issues with Webpack I had earlier and got things to run.
/api works fine, all collections and data is visible there.
/admin - while rendering it seems to have some issues figuring out collections to render, etc.
The admin panel seems to have fully reverted to default (users only have the base fields)
The original issue was with providing an empty mockfile/object
module.exports = {}
, but fixed and would render when provided
module.exports = () => () => ({})
which closer resembles the plugin signature.
Double and triple-checked the config returned from the plugin and it contains all collections. Even when returning it immediately it still happens.
Only when I remove the plugin from the plugins:[] the admin panel works as normal.
link to file dump, pre repackaging:
Ideas? 🙏
One thing I noticed:
Make sure to include potential pre-existing afterchange hooks with the spread operator as well - otherwise, it would break any other plugins adding their own afterchange hooks (as it completely overrides those)
As for your webpack config:
I'm not sure if it's a good idea to alias the entire firebaseNotifications file. This
mightbe the reason your collections are disappearing on the client
I'd make sure all of your server-only code is in a separate file (so extract the server-only code from your firebaseNotifications.ts into another file) and alias that instead
Make sure to include potential pre-existing afterchange hooks with the spread operator as well - otherwise, it would break any other plugins adding their own afterchange hooks (as it completely overrides those)
Done! Haven't pushed those updates yet, but I'll give the latter idea a spin. Thanks 🙂
Guess the fix I put together earlier just hid the actual problems. When not aliasing "firebase-admin" I get os.platform is not a fn.
And aliasing it gives me the second one.
Double checked config, looks fine still. Api still works 🥲
can you commit the changes, so i can check it out?
don't think you need the firebase.ts. Also don't think you need any of the webpack fallbacks.
Should be enough to move the hook contents + all of its firebase imports to its own file, and then alias that file. And no other file, just that one
Then in the hook in the firebasenotifications.ts file, you just call that function. And make sure you don't import any firebase stuff in the firebase notifications.ts
Sometimes you just need to sleep on it. Removed the fallbacks and did the things you mentioned, works like a charm! Thanks a bunch 🙏
Perfect, you're welcome!!
And the first notification sent from the plugin. Now on to some refactoring 🥳
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.