I struggle (a lot) on something easy.
I want to add this librairy "JQuery Orthodox View Engine" (aka JOVN) to JQuery. See: https://github.com/JocaPC/jquery-view-engine
In short: The Lib adds a new method to JQuery that can pick some JSON and render it in HTML TAGS that have a certain classname. To do so, i have to import jquery (installed with NPM) and this JOVN Librairy (locally, the NPM package doesn't exist)
import jQuery from 'jquery';
import './jovnLib';
But the jovnLib.js is like this:
(function($) {
$.fn.view = function (obj, options) {
if (!(typeof obj == 'object')) {
...
}
function loadSelect(nSelect, aoValues, name) {
...
}
function setElementValue(element, value, name) {
...
}
function bind(data, domNode, name) {
...
}
function init(placeholder) {
...
}
var defaults = {
...
};
properties = $.extend(defaults, options);
return this.each(function () {});
};
})(JQuery);
I understand that this import has side effects and need to find when it will run, the global variable jQuery, and i have the error:
Uncaught ReferenceError: jQuery is not defined (for the last line of JOVN Module)
Do I might await import or use window.load = () ... Thank you.