How do I use jstree in a javascript library (it's a stimulus controller, but that shouldn't matter).
import 'jstree';
import $ from 'jquery';
let treeElement = this.ajaxTarget; // a DOM element
let $element = $(this.treeElement); //
let tree = $element
.jstree({})
I can get this to work from within my application, using webpack, which handles jquery with a special command to make it global.
But when I create a library that I want to use in multiple project, I think I'm doing something wrong with importing jquery. I've been hacking away, require v. import, different order, setting a global.$ = $, etc.
Is there a way to invoke jstree on a DOM element, rather than turning the DOM object into a jQuery object and then calling the .jstree method on it? That "feels" like it'd be a better solution.
How do I use jstree in a javascript library (it's a stimulus controller, but that shouldn't matter).
I can get this to work from within my application, using webpack, which handles jquery with a special command to make it global.
But when I create a library that I want to use in multiple project, I think I'm doing something wrong with importing jquery. I've been hacking away, require v. import, different order, setting a global.$ = $, etc.
Is there a way to invoke jstree on a DOM element, rather than turning the DOM object into a jQuery object and then calling the .jstree method on it? That "feels" like it'd be a better solution.
Thanks.