diff --git a/index.js b/index.js index 20ba7478b8119..8b6f7ee218d88 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,17 @@ var path = require('path'); module.exports = function (kibana) { + var mainFile = 'plugins/timelion/app'; + + var ownDescriptor = Object.getOwnPropertyDescriptor(kibana, 'autoload'); + var protoDescriptor = Object.getOwnPropertyDescriptor(kibana.constructor.prototype, 'autoload'); + var descriptor = ownDescriptor || protoDescriptor || {}; + if (descriptor.get) { + // the autoload list has been replaced with a getter that complains about + // improper access, bypass that getter by seeing if it is defined + mainFile = 'plugins/timelion/app_with_autoload'; + } + return new kibana.Plugin({ require: ['kibana', 'elasticsearch'], uiExports: { @@ -9,7 +20,7 @@ module.exports = function (kibana) { title: 'Timelion', description: 'Time series expressions for everything', icon: 'plugins/timelion/icon.svg', - main: 'plugins/timelion/app', + main: mainFile, injectVars: function (server, options) { var config = server.config(); return { @@ -51,4 +62,4 @@ module.exports = function (kibana) { }, init: require('./init.js'), }); -};; +}; diff --git a/public/app_with_autoload.js b/public/app_with_autoload.js new file mode 100644 index 0000000000000..66d538a260174 --- /dev/null +++ b/public/app_with_autoload.js @@ -0,0 +1,2 @@ +require('ui/autoload/all'); +require('./app');