Closed quorth0n closed 8 years ago
When using the require:require
option, plugins have to be require()
'd in the calling module before using plugins.add()
, something like this:
require('voxel-health');
require('voxel-health-bar');
var createPlugins = require('voxel-plugins');
var plugins = createPlugins(game, {require:require});
//Load Plugins
plugins.add('voxel-health', {maxHealth: 20});
plugins.add('voxel-health-bar', {});
plugins.loadAll();
if you still see this when adding the require()s, could you include the full stacktrace for the "Uncaught TypeError: undefined is not a function" error.
In voxel-plugins 0.5.0+ (https://github.com/voxel/voxel-plugins/issues/8), added a new 'loaders' option which makes the dependencies clearer:
var createPlugins = require('voxel-plugins');
var plugins = createPlugins(game, {loaders:
'voxel-health': require('voxel-health'),
'voxel-health-bar': require('voxel-health-bar')
});
//Load Plugins
plugins.add('voxel-health', {maxHealth: 20});
plugins.add('voxel-health-bar', {});
plugins.loadAll();
Hello all, When I try calling plugins.add, I get the following error:
Uncaught TypeError: undefined is not a function
Here is my code:The error occurs where I attempt to add the voxel-health and the voxel-health-bar plugins.
Thank you all in advanced