# New Platform - is it possible to use modules from the legacy platform?

**URL:** <https://discuss.elastic.co/t/new-platform-is-it-possible-to-use-modules-from-the-legacy-platform/243208>\
**Category:** Kibana\
**Created:** [July 30, 2020, 11:11am UTC](https://discuss.elastic.co/t/new-platform-is-it-possible-to-use-modules-from-the-legacy-platform/243208 "2020-07-30T11:11:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndreaTosti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andreatosti/32/75172_2.png) [@AndreaTosti](https://discuss.elastic.co/u/AndreaTosti)\
**Post date:** [July 30, 2020, 11:11am UTC](https://discuss.elastic.co/t/new-platform-is-it-possible-to-use-modules-from-the-legacy-platform/243208/1 "2020-07-30T11:11:26Z")

</div>

I want to migrate my plugin to the new platform and I generated the skeleton using [https://github.com/elastic/kibana/tree/master/packages/kbn-plugin-generator](https://github.com/elastic/kibana/tree/master/packages/kbn-plugin-generator).

I have encountered two anomalies:

- On 7.7.0, after inserting `visualizations` in the `requiredPlugins` entry in `kibana.json`, visualizations does not work, resulting in "undefined" (I tried to use it in `plugin.ts`, both in `setup` and in `start`). The same plugin instead works on 7.8.0.
- On 7.8.0, after inserting `visualizations` in the `requiredPlugins` entry in `kibana.json`, this works, I can do everything, only that the visualization type "region\_map" is not in the list of all visualizations (`visualizations.all ()`), this should because of the "region\_map" migration to the New Platform occurred in 7.9.0 (see [link](https://github.com/elastic/kibana/pull/64272)).

The question then is: can I import the legacy **"visualizations" plugin** into a Kibana New Platform plugin?

Thanks, I remain available for clarification

---

<div class="post-metadata">

**Author:** ![joshdover](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshdover/32/42020_2.png) [@joshdover](https://discuss.elastic.co/u/joshdover)\
**Post date:** [July 30, 2020, 8:33pm UTC](https://discuss.elastic.co/t/new-platform-is-it-possible-to-use-modules-from-the-legacy-platform/243208/2 "2020-07-30T20:33:57Z")

</div>

> [@AndreaTosti](#):
>
> The question then is: can I import the legacy **"visualizations" plugin** into a Kibana New Platform plugin?

Unfortunately, no there is no way to do this from a new plugin. We've been careful to keep the new plugins free of any legacy code, so it's possible for legacy plugins to access new plugins (via importing from `ui/new_platform`) but not the other way around.

You can use the services in `ui/new_platform` to emulate a new plugin from within a legacy plugin, but it requires some manual steps:

- You should load your plugin via a "hacks" uiExport to ensure your plugin is always loaded
- You must run the "setup" and "start" functions of your plugin yourself
- There are some limitations, for example, while legacy plugins can "depend on" any other new plugin via the `ui/new_platform` exports, these dependencies are not programmatically enforced. So you must handle the case where your dependency has been disabled. For custom development, this may not be a concern, but if your plugin is shared with others, it may be.

The [vis\_type\_metric plugin on the 7.7 branch](https://github.com/elastic/kibana/blob/7.7/src/legacy/core_plugins/vis_type_metric/public/legacy.ts) is a good example of this pattern. You'll notice in the index.js file there is a "hack" that points to the "public/legacy" file. This file handles setting up and starting the plugin manually.

The other option would be to wait for the 7.9 release in which all of the visualizations have been migrated. I don't have any timeline on when this will be released, but you can start developing against the 7.9 branch today.

---

<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:** [August 27, 2020, 8:34pm UTC](https://discuss.elastic.co/t/new-platform-is-it-possible-to-use-modules-from-the-legacy-platform/243208/3 "2020-08-27T20:34:01Z")

</div>

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