Cache Kibana bundles at restart

Hello,
I develop plugins for Kibana 5.5.0. Some of them uses libraries published as node modules. When I make a change inside a module I need to restart the Kibana server in order to rerun the lazy optimize step and to package my plugin using the newly modified module. The problem is that the the lazy optimize is executed again for all the bundles (kibana, stateSessionStorageRedirect, timelion, sense-tests, status_page, etc) and the process last ~40s. It is possible to preserve bundles between server restarts and to rebuild just a required bundle?
I have tried using optimize.bundleFilter but it seems that it does not preserve the old bundle files.

Thank you,
Cosmin

Unfortunately, I don't think this is possible right now, and I'm not sure whether it would even be possible to create a solution like you describe within the current build tooling. Webpack has to reach into existing bundles to determine whether some node_module in your source code should be added to the common bundle rather than isolated to only your plugin otherwise we'll be duplicating a lot of dependencies across plugins in the browser.

I think webpack should rebundle when node_modules is changed though, so a full restart isn't necessary. If that's not how it works today, that's how it should work.

In any even, this whole class of problem should go away when we have then new build system, which creates immutable bundles for Kibana, so you can build your plugin in isolation: https://github.com/elastic/kibana/issues/10908

Thank you for the response. I made some tests, and indeed webpack rebundles when node_modules is changed, the process being significantly faster.

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