Kibana plugin dev: loading order for "hacks"

In my plugin index.js I declare 5 "hacks" as an array.

They are all loaded, but the order Kibana runs them is not the same I am declaring them. In fact the ordering happens to be: 1,5,3,2,4 instead of 1,2,3,4,5.

This is a problem because some hacks rely on dom objects that are being injected by another hack.

I think the declared order for hacks should be respected by Kibana.

Hi Simone,

there is currently no guarantee on the execution order of hacks. If you need them to be executed in a very specific order, I would recommend creating one file, that you put into your hacks array and just import the other files in this file, in which case the order will stay deterministic.

Since we are currently working on a new platform (https://github.com/elastic/kibana/issues/9675) which will change a lot of extension points and way of things to function, I think there won't be any further changes to the way we load hacks and instead rely in the future on new platform capabilities for that.

Cheers,
Tim

Hi Tim, thanks for the answer.
Do you mean that when the old platform's plugin API will be dropped, we won't have the possibility to define "hacks" at all?

Also, where can I find an example of a plugin that targets the new platform only? Or even some documentation about the current new platform's plugin API?

Hi,

I think there will also be in the new platform a way to provide "generic loaded JS" functionallity via plugins (maybe @Court can clarify on that?) The new platform is currently still a work in progress so there are no complete plugins yet using only new platform and nothing else. You can find the documentation that exists already here: https://github.com/elastic/kibana/tree/master/src/core

Cheers,
Tim

I think there will also be in the new platform a way to provide "generic loaded JS" functionallity via plugins

This is correct. The new plugin system by its very nature loads JavaScript from every plugin, so while there won't be the notion of "hacks" in the sense that there is today, many hack extensions will be able to be moved into the plugin class itself as part of the new platform migration.

It's worth emphasizing at this point that we'll provide a lot more information about the new plugin system in 7.x to help people migrate. We won't turn off the old plugin system while plugin developers are still in the dark.

1 Like

Thank you @Court and @timroes. I suppose the new info and documentation will be published somewhere here?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.