Closed felixheck closed 7 years ago
I guess you mean that one plugin is dependent on another? So you want to control the load order? Glue registers the plugins by the registrations array order. Beyond that you'll want to manage your plugin dependencies - https://github.com/hapijs/glue/blob/master/API.md#notes
Yeah but the dependency is not really a dependency. It is possible to use the plugins without the other one.
Use Case: Plugin A is a plugin without a decorator. It just run some code in the background. Plugin B is plugin decoration the server object.
It is possible to use A without B but the usage gets simplified with B. So even when I load B before A it does not help because I could not access the decorated server object within the registrations.
I guess I am not yet understanding. Each plugin registration function has access to the server object. Are you saying that when Plugin B is registered first and it decorates the server object, that then when Plugin A is registered second, the server object passed to Plugin A is not decorated?
Yeah but I need the decorated server object within the glue
registration process, because I need it for some options of the second registration..
I'll prepare a minimal working example tomorrow :)
Any update here? If you can create a simple example without using glue (just directly calling server.register) that shows how the first plugin decorates the server object, but the decoration does not show up in the 2nd plugin's server object, then I suggest opening an issue on the hapi project to find out if that is expected or not. This seems out of scope for glue to care about.
It does not matter anymore. Contributed to one of the plugins to solve this issues. It a workaround but i think the only solution. Nevertheless: thanks!
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
Hi there!
I'm using
glue
in lots of projects, it's quite nice. Well done 😉 Butmanifest.registrations
accepts currently an array of objects andoptions.preRegister
is a callback function w/ the signaturefunction(server, next)
.I would like to use alternatively a function instead of the array of objects. The signature could be
function(server)
and the return value is again an array of objects.Currently I'm using a few hapi plugins which decorate
server
and I would like to use these methods within the registration of further plugins. So for the moment I register those plugins inmanifest.registrations
and register the further plugins within theglue.compose
callback. It is not really smart. My aim is that all the registrations are managed byglue
.What do you think about this API change/extension? 😄 Thanks so far.
Cheers!