Module not found error when including TemplateVisType class


(Yu Watanabe) #1

Hi!

I am now building custom visualization plugin on kibana and
I would like to ask question about custom visualization.

My environment is kibana alpha5.0.0-alpha5.
I have used git clone https://github.com/elastic/kibana.git
when I created kibana environment.

I am getting below error when I try to access kibana from the browser.

ERROR in ./plugins/access/public/agg.js
Module not found: Error: Cannot resolve 'file' or 'directory' /home/hoge/dev/kibana/src/ui/public/template_vis_type/TemplateVisType in /home/hoge/dev/kibana/plugins/access/public
 @ ./plugins/access/public/agg.js 4:32-79

at Object.exports.create (/home/creationline/dev/kibana/node_modules/boom/lib/index.js:21:17)
at LazyOptimizer.failedStatsToError (/home/creationline/dev/kibana/src/optimize/base_optimizer.js:201:17)
at Compiler.<anonymous> (/home/creationline/dev/kibana/src/optimize/lazy/lazy_optimizer.js:44:22)
at Compiler.applyPlugins (/home/creationline/dev/kibana/node_modules/tapable/lib/Tapable.js:26:37)
at Watching._done (/home/creationline/dev/kibana/node_modules/webpack/lib/Compiler.js:78:17)
at Watching.<anonymous> (/home/creationline/dev/kibana/node_modules/webpack/lib/Compiler.js:51:17)
at /home/creationline/dev/kibana/node_modules/webpack/lib/Compiler.js:403:12
at Compiler.next (/home/creationline/dev/kibana/node_modules/tapable/lib/Tapable.js:67:11)
at Compiler.<anonymous> (/home/creationline/dev/kibana/node_modules/webpack/lib/CachePlugin.js:40:4)
at Compiler.applyPluginsAsync (/home/creationline/dev/kibana/node_modules/tapable/lib/Tapable.js:71:13)
at Compiler.<anonymous> (/home/creationline/dev/kibana/node_modules/webpack/lib/Compiler.js:400:9)
at Compilation.<anonymous> (/home/creationline/dev/kibana/node_modules/webpack/lib/Compilation.js:576:13)
at Compilation.applyPluginsAsync (/home/creationline/dev/kibana/node_modules/tapable/lib/Tapable.js:60:69)
at Compilation.<anonymous> (/home/creationline/dev/kibana/node_modules/webpack/lib/Compilation.js:571:10)
at Compilation.applyPluginsAsync (/home/creationline/dev/kibana/node_modules/tapable/lib/Tapable.js:60:69)
at Compilation.<anonymous> (/home/creationline/dev/kibana/node_modules/webpack/lib/Compilation.js:566:9)
Error: Optimizations failure.

I have wrote my "aggs.js" under public directory as below.

function AggProvider(Private) {
  var TemplateVisType = Private(require('ui/template_vis_type/TemplateVisType'));

  return new TemplateVisType({
    name: 'agg',
    title: 'Sample Aggregation',
    icon : 'fa-cloud',
    description : 'Sample backend aggregation for kibana',
    requiresSearch : true,
    template : require('plugins/access/agg.html')
  });
}

Do I have anything wrong with my Private() ?


(Jim Unger) #2

Shouldn't:

var TemplateVisType = Private(require('ui/template_vis_type/TemplateVisType'));

be

var TemplateVisType = Private(require('ui/template_vis_type/template_vis_type'));

?

I think in this case, the error message was right on the money. :wink:


(Yu Watanabe) #3

Error is gone now.

Thank you.


(system) #4