# Cache Kibana bundles at restart

**URL:** <https://discuss.elastic.co/t/cache-kibana-bundles-at-restart/104071>\
**Category:** Kibana\
**Created:** [October 16, 2017, 9:56am UTC](https://discuss.elastic.co/t/cache-kibana-bundles-at-restart/104071 "2017-10-16T09:56:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ccrecana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ccrecana/32/17142_2.png) [@ccrecana](https://discuss.elastic.co/u/ccrecana)\
**Post date:** [October 16, 2017, 9:56am UTC](https://discuss.elastic.co/t/cache-kibana-bundles-at-restart/104071/1 "2017-10-16T09:56:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Court](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/court/32/6640_2.png) [@Court](https://discuss.elastic.co/u/Court)\
**Post date:** [October 17, 2017, 10:27am UTC](https://discuss.elastic.co/t/cache-kibana-bundles-at-restart/104071/2 "2017-10-17T10:27:35Z")

</div>

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](https://github.com/elastic/kibana/issues/10908)

---

<div class="post-metadata">

**Author:** ![ccrecana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ccrecana/32/17142_2.png) [@ccrecana](https://discuss.elastic.co/u/ccrecana)\
**Post date:** [October 17, 2017, 11:34am UTC](https://discuss.elastic.co/t/cache-kibana-bundles-at-restart/104071/3 "2017-10-17T11:34:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 14, 2017, 11:34am UTC](https://discuss.elastic.co/t/cache-kibana-bundles-at-restart/104071/4 "2017-11-14T11:34:45Z")

</div>

Closed on November 14, 2017, 11:34am UTC

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