I'm developing a node library that depends on jQuery and jqueryUI. I use browserify to make it accessible to a browser page.
So in my library code, there can be for example such kind of code:
var createMenu = function (target, options) {
$target = $(target);
$target.menu(options);
}
I require jQuery and jQueryUI like this:
var $ = jQuery = require("./node_modules/jquery");
require("./node_modules/jquery-ui-dist");
but when I call createMenu function in the browser, it logs TypeError: $target.menu is not a function.
JQueryUI doesn't seem to be properly loaded but I didn't find documentation on how to load it properly.
I also tried $.ui = require('./node_modules/jquery-ui/ui/widget.js') without any more luck.
If I do the following:
jQueryUI = require("./node_modules/jquery-ui")
console.log(jQueryUI)
it only logs an empty object.
Any idea on the proper way to log jQueryUI to use it in nodejs?
windowobject which simply does not exist server side where node runs. JQuery is for traversing the DOM and some simple animations. I don't expect this is what you are trying to do server side? Maybe you can give more context of what you are trying to achieve?