Add worker-loader into kibana

Hi there,

I read 195162 and try to add worker-loader with the same solution.

I ended up with nothing happen.
My custom:

 __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?

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

publicDir: resolve(__dirname, 'public'),

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

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

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

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

@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

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

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