# Build error when using \`kibanaReact\` and \`kibanaUtils\` in kibana 3rd party plugin

**URL:** <https://discuss.elastic.co/t/build-error-when-using-kibanareact-and-kibanautils-in-kibana-3rd-party-plugin/261748>\
**Category:** Kibana\
**Tags:** kibana-plugin-development\
**Created:** [January 21, 2021, 8:47am UTC](https://discuss.elastic.co/t/build-error-when-using-kibanareact-and-kibanautils-in-kibana-3rd-party-plugin/261748 "2021-01-21T08:47:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_wei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_wei/32/79499_2.png) [@Eric\_wei](https://discuss.elastic.co/u/Eric_wei)\
**Post date:** [January 21, 2021, 8:47am UTC](https://discuss.elastic.co/t/build-error-when-using-kibanareact-and-kibanautils-in-kibana-3rd-party-plugin/261748/1 "2021-01-21T08:47:15Z")

</div>

Hello,

I'm trying to use `kibanaReact` and `kibanaUtils` in my kibana plugin.  
These 2 plugins added as `requiredBundles` in the kibana.json,

```auto
...
"requiredBundles": ["kibanaUtils", "kibanaReact"]
...

```

But error keep happens when run `yarn build`

```auto
Bundle for [testPlugin] lists [kibanaUtils, kibanaReact] as a required bundle, but does not use it. Please remove it.

```

Could you help me about this?  
Thank you very much~

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [January 21, 2021, 8:52am UTC](https://discuss.elastic.co/t/build-error-when-using-kibanareact-and-kibanautils-in-kibana-3rd-party-plugin/261748/2 "2021-01-21T08:52:17Z")

</div>

Are you actually using these? So, is there code in your plugin actually importing something from these plugins?

---

<div class="post-metadata">

**Author:** ![Eric\_wei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_wei/32/79499_2.png) [@Eric\_wei](https://discuss.elastic.co/u/Eric_wei)\
**Post date:** [January 21, 2021, 8:55am UTC](https://discuss.elastic.co/t/build-error-when-using-kibanareact-and-kibanautils-in-kibana-3rd-party-plugin/261748/3 "2021-01-21T08:55:40Z")

</div>

Yes, I'm using `toMountPoint` from `import { toMountPoint } from '../../../../src/plugins/kibana_react/public';` and using `Storage` from `import { Storage } from '../../../../src/plugins/kibana_utils/public';`.

For example,

```auto
import { Storage } from '../../../../src/plugins/kibana_utils/public';

const local = new Storage(window.sessionStorage);
console.log(local);

```

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [January 21, 2021, 9:05am UTC](https://discuss.elastic.co/t/build-error-when-using-kibanareact-and-kibanautils-in-kibana-3rd-party-plugin/261748/4 "2021-01-21T09:05:14Z")

</div>

Are the files where you use it part of the main entrypoint? What I mean is there a series of imports connecting these files to the main `public/index.ts` file of your plugin?

---

<div class="post-metadata">

**Author:** ![Eric\_wei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_wei/32/79499_2.png) [@Eric\_wei](https://discuss.elastic.co/u/Eric_wei)\
**Post date:** [January 21, 2021, 9:15am UTC](https://discuss.elastic.co/t/build-error-when-using-kibanareact-and-kibanautils-in-kibana-3rd-party-plugin/261748/5 "2021-01-21T09:15:53Z")

</div>

Nope, I'm using it in `public/application.tsx`

> <https://github.com/eric-wei1990/test-kibana-plugin/blob/ed8cd67397c8ab1806a078ac10de5c803e62554a/public/application.tsx#L8>

Please check this repo:

> **[eric-wei1990/test-kibana-plugin](https://github.com/eric-wei1990/test-kibana-plugin)**
>
> Contribute to eric-wei1990/test-kibana-plugin development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![Eric\_wei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_wei/32/79499_2.png) [@Eric\_wei](https://discuss.elastic.co/u/Eric_wei)\
**Post date:** [January 21, 2021, 9:30am UTC](https://discuss.elastic.co/t/build-error-when-using-kibanareact-and-kibanautils-in-kibana-3rd-party-plugin/261748/6 "2021-01-21T09:30:14Z")

</div>

I also checked some example in `x-pack`, for example, monitoring:

> <https://github.com/elastic/kibana/blob/922abfa21e1dac9a5f5dea837eb4f3a25b4999b9/x-pack/plugins/monitoring/public/angular/app_modules.ts#L16>

  
It doesn't load import anything in `public/index.ts`.

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [January 21, 2021, 9:34am UTC](https://discuss.elastic.co/t/build-error-when-using-kibanareact-and-kibanautils-in-kibana-3rd-party-plugin/261748/7 "2021-01-21T09:34:17Z")

</div>

Loading it in `application.ts` should be fine. I wrote

> What I mean is there a series of imports connecting these files to the main `public/index.ts` file of your plugin?

In your plugin `index.ts` imports `plugin.ts` which imports `application.ts` - that's what I was talking about. Is there a series of imports connecting your usage of kibana utils to `index.ts`. As that's the case, the problem has to be somewhere else, I'm looking into the issue.

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [January 21, 2021, 9:43am UTC](https://discuss.elastic.co/t/build-error-when-using-kibanareact-and-kibanautils-in-kibana-3rd-party-plugin/261748/8 "2021-01-21T09:43:53Z")

</div>

Thanks, that's helpful. I reached out to the team managing the build process to confirm, but it looks like for 3rd party plugins you simply can't use the `requiredBundles` setting - simply omit it and the build should work.

This is a special setting for sharing bundles for the built-in plugins and it's not relevant for custom plugins.

If there's more info I will update this thread.

---

<div class="post-metadata">

**Author:** ![Eric\_wei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_wei/32/79499_2.png) [@Eric\_wei](https://discuss.elastic.co/u/Eric_wei)\
**Post date:** [January 21, 2021, 9:46am UTC](https://discuss.elastic.co/t/build-error-when-using-kibanareact-and-kibanautils-in-kibana-3rd-party-plugin/261748/9 "2021-01-21T09:46:30Z")

</div>

Thanks for your kindly helping, that's solve me a lot time.  
😀

---

<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:** [February 18, 2021, 9:46am UTC](https://discuss.elastic.co/t/build-error-when-using-kibanareact-and-kibanautils-in-kibana-3rd-party-plugin/261748/10 "2021-02-18T09:46:46Z")

</div>

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