Can't resolve `ui/registry/vis_types` [7.5]

According to the current (7.5) documentation for "Developing Visualizations":

import { VisFactoryProvider } from 'ui/vis/vis_factory';
import { VisTypesRegistryProvider } from 'ui/registry/vis_types';

However, after generating a plugin via scripts/generate_plugin.js... and running yarn start, I get the error:
Module not found: Error: Can't resolve 'ui/registry/vis_types'

This appears to be caused by the removal of this file between the 7.4 -> 7.5 branch, which is from where the previous version of my visualization pulled VisTypesRegistryProvider. What am I doing wrong here?

2 Likes

I have a same issues. Shoud i use ui/registry/_registry ??

Official document https://www.elastic.co/guide/en/kibana/current/development-visualization-factory.html is wrong??

Yes the documentation is incorrect. The following seems to be working for me-- haven't yet noticed any downstream effects:

import { visFactory } from 'ui/vis/vis_factory';
import { setup, start } from '..../core_plugins/visualizations/public/legacy';

const myVis = () => visFactory.createReactVisualization({...});

setup.types.registerVisualization(myVis);
1 Like

It's not working to me, do we need to do any additional step ?

While install its saying the same Error: Can't resolve '..../core_plugins/visualizations/public/legacy'

You must find the correct relative import for your visualization's file structure; so for me, that line reads:

import { setup, start } from '../../../src/legacy/core_plugins/visualizations/public/np_ready/public/legacy';

The legacy.ts file that you are importing lives in (from project root): kibana/src/legacy/core_plugins/visualizations/public/np_ready/public/.

1 Like

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