How does the bundling mechanism works?

Hi there,
I'm trying to change some little things in the core view (like not showing the toolbar or removing all the tabs on the right of the logo). I'm using the distribution downloaded from the download page of Kibana (both windows and linux).
I cannot understand how the bundling mechanism works. Should I change the source files (those into /src/ui)? If yes, how can I tell to kibana to start the bundle? If I make any changes and restart the server the bundle seems to not start and I cannot see any modification in the resulting bundle.
What will happen if I modify directly the bundled files (those into /optimize/bundles)? When these files will be overwritten by a new bundle operation, causing me to lose all my modification?

Thank you all.

If you're modifying Kibana source code, I'd suggest getting started with the contributing guide:

If you start the Kibana server with npm start, then as you make changes to source files, they will automatically be rebundled. You shouldn't have to touch the bundled files themselves.

I hope this answers your question, and if it doesn't, please let me know!

Hi Lukas,
not exactly. I'm working directly on the deb package installed on production server. If I modify the bundled files, is there any chance they will be overwritten?

They'll be overwritten if you stop and start the Kibana server.

Hi Lukas,
in my homologation environment it seems to remain the same, and never rebuild. I have restarted the service several times, but the modifications I made on the bundle files remain always the same. This is why I cannot understand how the build mechanism is actually working, I was thinking it should work like you said.

@napcoder the build is actually cached based on the version numbers of all the plugins. In order to trigger a rebuild you have to delete the optimize/bundles/ directory in the kibana install. Then the build system will realize there is no build and recreate it.

4 Likes

Thank you a lot @spalger, this is exactly what I was looking for.
Do you guys know a way to let the build copy some images from /src/ui/public/images/ to optimize/bundles/src/ui/public/images/ ?

If you put your images in a plugin they will be available, and you won't have to modify the source, or you can import the images from any of the source files and then the image will be marked to be included in the build.

1 Like

Thank you very much @spalger, you solved all my problems :slight_smile: