# Add worker-loader into kibana

**URL:** <https://discuss.elastic.co/t/add-worker-loader-into-kibana/261786>\
**Category:** Kibana\
**Tags:** kibana-plugin-development\
**Created:** [January 21, 2021, 1:11pm UTC](https://discuss.elastic.co/t/add-worker-loader-into-kibana/261786 "2021-01-21T13:11:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![phinguyen202](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phinguyen202/32/82679_2.png) [@phinguyen202](https://discuss.elastic.co/u/phinguyen202)\
**Post date:** [January 21, 2021, 1:11pm UTC](https://discuss.elastic.co/t/add-worker-loader-into-kibana/261786/1 "2021-01-21T13:11:49Z")

</div>

Hi there,

I read [195162](https://discuss.elastic.co/t/custom-webpack-settings-integration-with-kibana-plugin/195162) and try to add worker-loader with the same solution.

I ended up with nothing happen.  
My custom:

```auto
 __bundleProvider__ (kbnServer) {
        console.log(' __bundleProvider__');
        const defaultGetExtendedConfig = kbnServer.uiBundles.getExtendedConfig;

        kbnServer.uiBundles.getExtendedConfig = (webpackConfig) => {
           console.log('webpackConfig');
          webpackConfig.module.rules.push({
            test: /\.worker\.js$/,
            loader: require.resolve('worker-loader'),
          });
          return defaultGetExtendedConfig.call(kbnServer.uiBundles, webpackConfig);
        };
      },

```

" **bundleProvider**" is show on console but 'webpackConfig'.  
worker-loader is installed in the plugin.

In my app.js, i added something like:  
import '.../abc.worker.js'

I expect that it will work fine but not.

Is there any way to check my loader has been added successfully?

---

<div class="post-metadata">

**Author:** ![phinguyen202](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phinguyen202/32/82679_2.png) [@phinguyen202](https://discuss.elastic.co/u/phinguyen202)\
**Post date:** [January 25, 2021, 4:30am UTC](https://discuss.elastic.co/t/add-worker-loader-into-kibana/261786/2 "2021-01-25T04:30:38Z")

</div>

I have found a workaround solution for this. Using `publicDir`:

```auto
publicDir: resolve(__dirname, 'public'),

```

Then copy worker file to public folder.  
If you are using pdfjs, just setting up as following

```auto
import * as pdfjs from "./pdfjs-dist";

pdfjs.GlobalWorkerOptions.workerSrc = '../plugins/<plugin name>/public/worker.js';

```

* * *

Update:  
Unfortunately, it doesn't work after build 😢

---

<div class="post-metadata">

**Author:** ![tiagocosta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tiagocosta/32/40045_2.png) [@tiagocosta](https://discuss.elastic.co/u/tiagocosta)\
**Post date:** [February 1, 2021, 1:06pm UTC](https://discuss.elastic.co/t/add-worker-loader-into-kibana/261786/3 "2021-02-01T13:06:59Z")

</div>

@phinguyen202 what version of Kibana are you using and developing plugins for? If it's not 7.10 are you planning to upgrade to 7.10+? On that version your plugins build will be independent from the Kibana one and you will be able to do everything you want with it.

Cheers

---

<div class="post-metadata">

**Author:** ![phinguyen202](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phinguyen202/32/82679_2.png) [@phinguyen202](https://discuss.elastic.co/u/phinguyen202)\
**Post date:** [February 2, 2021, 4:46am UTC](https://discuss.elastic.co/t/add-worker-loader-into-kibana/261786/4 "2021-02-02T04:46:22Z")

</div>

Hi @tiagocosta ,  
Thank you for your reply.  
Kibana v7.5.2 is used in ours system, and unfortunately we can't upgrade to 7.10+ for some reasons.  
I have found a workaround solution, but inconvenient, that have to modify .zip file a little bit after running build.  
Anyway, i'm glad to know that building plugin will be independent in the kibana 7.10+ versions.

Thanks

---

<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:** [March 2, 2021, 4:47am UTC](https://discuss.elastic.co/t/add-worker-loader-into-kibana/261786/5 "2021-03-02T04:47:09Z")

</div>

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